You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 601 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Chris Hecker
Version: 3.03
OS: all
Submission from: node-d8e9cca2.powerinter.net (216.233.204.162)
The data pointer in the caml_bigarray struct is not allocated and deallocated
consistently in bigarray_stubs.c. Somtimes stat_alloc is used and sometimes
malloc is used, but stat_free is never used. For example, in the latest cvs
sources (Oct 30, 17:00 PST):
The data pointer in the caml_bigarray struct is not allocated and deallocated
consistently in bigarray_stubs.c. Somtimes stat_alloc is used and sometimes
malloc is used, but stat_free is never used. For example, in the latest cvs
sources (Oct 30, 17:00 PST):
I agree it's a bit of a mess :-) We can't use stat_alloc() on line 653
because it may raise an exception, while we are not allowed to raise
exceptions in the middle of an input_value operation.
Concerning the free() on lines 400 and 403, the idea is that some C
code can create a Caml bigarray via alloc_bigarray, passing it data
allocated with the standard malloc(), and requesting (via the
BIGARRAY_MANAGED flag) that OCaml calls free() on the data when the
bigarray dies.
It seems that stat_alloc/stat_free should always be used for
consistency (and if the runtime wants to do some tracking/debugging
underneath).
I agree that stat_alloc and stat_free should always be used in pairs
for the reason you mention. Given the constraints I mentioned above,
this means that the stat_alloc on line 94 should be replaced by malloc
plus an explicit test on the result...
Original bug ID: 601
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Chris Hecker
Version: 3.03
OS: all
Submission from: node-d8e9cca2.powerinter.net (216.233.204.162)
The data pointer in the caml_bigarray struct is not allocated and deallocated
consistently in bigarray_stubs.c. Somtimes stat_alloc is used and sometimes
malloc is used, but stat_free is never used. For example, in the latest cvs
sources (Oct 30, 17:00 PST):
94: data = stat_alloc(size);
653: b->data = malloc(elt_size * num_elts);
400: free(b->data);
403: free(b->proxy->data);
It seems that stat_alloc/stat_free should always be used for consistency (and if
the runtime wants to do some tracking/debugging underneath).
Chris
The text was updated successfully, but these errors were encountered: