lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

 Yes of course :) All our objects have a __gc metamethod implemented !
But the core issue is that for each object allocated internally, onlye 4 bytes/8bytes are seen from the LUA garbage collector... But internally, megaoctets are allocated... Hence, the garbage collector does not trigger "properly", and we ran out of memory.

Currently, i strongly constrain the gc with the mul factor, but this is a dirty workaround IMHO. This is why i suggest to add a way to indicate to the gc engine the real size of memory allocated for a userdata (and not not only the size indicated in the lua_newuserdata function)

Le 02/09/2010 21:49, Jonathan Castello a écrit :
On Thu, Sep 2, 2010 at 12:14 PM, Sylvain Fabre
<>  wrote:
  This is an option too, but in that case, i need to know wich objects are
marked as 'free' from the LUA engine. An right now, i do not know if there
is a way to achieve this.
Have you looked into the __gc metamethod that you can use on full
userdata? It's called when the Lua GC is collecting that userdatum,
and it's good for releasing attached memory in C, decrementing
refcounts, closing file descriptors, and so on.


Sylvain FABRE
Fixe: 09 72 11 30 24
Mobile: 06 30 12 72 34
Fax : 09 72 11 10 71