On 2010-09-07, at 22:58, Paolo Donadeo wrote:

> The problem is that, for several good reasons, I need a copy, or a reference, 
> to the OCaml value representing the lua_State (v_L in the code above) inside 
> the Lua state (I mean the C data structure).

That creates a cross-heap reference loop and it's very bad news for the GC.

> As a temporary workaround I removed the "value state_value" field from the 
> ocaml_data struct, replacing it with a reference counter:

Maybe you could try something similar, with a weak hash table to recover the
OCaml value corresponding to a given lua_State, thus eliminating the need for
a reference counter.  Use the address of the lua_State for hashing and for
comparison.

Drawback: the weak hash table has to be global.

-- Damien

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to