On Fri, Jul 1, 2011 at 3:49 PM, Damien Doligez <[email protected]> wrote: > > On 2011-07-01, at 11:09, Dmitry Bely wrote: > >> Does this fragment violate GC interface rules: >> >> Begin_roots_block(_varg, 2) >> _varg[0] = ((struct camlidl_intf *) this)->caml_object; >> _varg[1] = camlidl_alloc_small(1, Abstract_tag); >> Field(_varg[1], 0) = (value) log; >> End_roots(); >> _vres = caml_callbackN_exn(caml_get_public_method(_varg[0], >> Val_int(1007700946)), 2, _varg); >> >> It's unsafe to pass _varg to caml_callbackN_exn when it is not >> referenced from local_roots, right? > > > You're right, this code looks buggy.
I tend to think now that this part is OK; _varg is not used after caml_callbackN_exn so local_roots are not needed. But what happens inside caml_callbackN_exn()? How it assures that _varg is not garbage-collected before the closure is applied? This is camlidl-generated code (slightly modified to be thread-safe) and I have an access violation (segmentation fault) error in multi-threaded environment under heavy load. Just trying to figure out what can be wrong here... - Dmitry Bely -- Caml-list mailing list. Subscription management and archives: https://sympa-roc.inria.fr/wws/info/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
