lua-users home
lua-l archive

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

Ralph Hempel wrote:
A tunable parameter for the garbage coellctor that either works the
way it currently does (as a percentage) or as an absolute value would
be in interesting compromise.

As I said in a previous post, I'm still trying to understand that "as a percentage"... of what?

To avoid problems due to my limited understanding of the above point, I coded my own poor man's emergency gc, using 'count' periodically and keeping a margin for the (estimated) efficiency of the allocator I'm using (keeping track of the exact amount of used memory or walking the heap to compute it would cost too much). Luckily I'm only doing small allocations.

Note that you'll still have the same problem with an absolute limit: used heap > allocated memory, because of allocator's efficiency/overhead, even not counting fragmentation. So I'm afraid an absolute limit would not be a good subsitute for a real emergency gc when an allocation fails.