Version française
Home     About     Download     Resources     Contact us    
Browse thread
Binding the Lua library [was: adding a scripting language to an ocaml program]
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Paolo Donadeo <p.donadeo@g...>
Subject: Re: [Caml-list] Binding the Lua library [was: adding a scripting language to an ocaml program]
On Tue, Jul 6, 2010 at 23:28, Guillaume Yziquel
<guillaume.yziquel@citycable.ch> wrote:
>> And, of course, any ideas or help on the garbage collector(s) issue are
>> welcome.
> I do not know much about Lua's GC. My experience (for R, Python and Java) is
> that it's doable.

The GC implemented in Lua [1] is an incremental mark-and-sweep
collector. Since Lua type system is simple (nil, boolean, number,
string, function, userdata, thread, for coroutines, and tables) it
automatically collects everything without problems. The strategy for
basic types is to copy values from the C (or OCaml) side to the Lua
stack: this copy decouples the two GC and sets them free to deallocate
values.

Problems arise when one tries to share userdata or closures between
OCaml and Lua. In this case it's not clear (at least to me) how to
approch the problem.



[1] http://www.lua.org/manual/5.1/manual.html#2.10


-- 
Paolo â  â µ