lua-users home
lua-l archive

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

Hi all,
I am facing currently an issue with the mix of "boxed userdata" and the garbage collector in one of our tools :
  • Our userdatas exchanged between LUA and C are full-userdata, but "boxed" : we allocate a newuserdata with the size of a pointer, and we set the pointer to an internallly allocated structure.
  • Those internal structures are handling pictures, leading to allocation of bigs memory chunks.
  • But, from the LUA point of view, we allocate only a pointer (ie 4 or 8 bytes typically) : so the memory computed by the garbage collector is very low
  • As a consequence, we run out of memory very quickly and we are obliged to tweak the values of the PAUSE/MUL in the gc, wich is not completly satisfactory.
I would like to know if this issue has already been adressed by someone somewhere ?
If not, i would suggest to add  (in lua 5.3 :) ? ) a way to allow the increase/decrease of the memory counter used in the garbage collector from the "external world" (either with a new lua_gc method or with a lua_newuserboxeddata).
Any suggestion or ideas on this ?

Thanks, S. FABRE