lua-users home
lua-l archive

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



Le 22 oct. 2013 à 17:12, Rena <hyperhacker@gmail.com> a écrit :

I've heard a few proposals before that the Lua GC could stand to have some way to tell it that a userdata has an additional n bytes associated with it, beyond the size of the userdata itself, so that it can better manage large objects. It seems like a good idea to me, as often a full userdata contains only a pointer to a large object allocated by C code, so Lua sees only 4-8 bytes used by something that's actually much larger. Did that idea ever go anywhere?

Unfortunately the actual size of the allocated memory associated to a userdata is in many cases not known by the userdata creator code, especially when the userdata is a pointer to an object created elsewhere in the system, e.g. an image or a complex data structure.

That's why the existing ways in Lua  to control the GC pause and step multipliers are just fine for my use case.
The memory management issue comes from the almost-non-incremental invocation of finalizers in the current version.