digego / extempore

A cyber-physical programming environment
1.41k stars 127 forks source link

zone memory warnings don't seem to work as described in docs #304

Open OYTIS opened 7 years ago

OYTIS commented 7 years ago

I was playing with the following example from the docs:

(bind-func fill_buffer_closure_zone
  (let ((region_length 1000)
        (int_buf:i64* (zalloc region_length))
        (i:i64 0))
    (lambda ()
      (dotimes (i region_length)
        (pset! int_buf i i))
      (printf "int_buf[366] = %lld\n"
              (pref int_buf 366)))))

According to the docs it should have given me a warning about exceeding the 8Kb of the default zone size, but it compiled silently. I've tried to increase region_length gradually and it was compiling without a warning until it just segfaulted at region_length somewhere between 1G and 2G.

digego commented 7 years ago

Yes, the docs are outdated - we now automagically expand the region as required - so the docs need an update. A separate, but important issue, is that we are clearly no adequately checking for memory availability. This would be worth raising as a separate issue.

A pull request on the docs would be appreciated

benswift commented 7 years ago

Actually, there's a docs re-jig in the works - perhaps wait 1 week :) It'll soon be easier to contribute to the docs.