[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: The Lua 5.1(work) GC
- From: "Trevor Powell" <lua@...>
- Date: Tue, 25 May 2004 08:48:46 +1000 (EST)
> this is
> what I wanted: "just specify the amount of wasted memory to be tolerated
> as a percentage of in-use memory, with higher tolerance translating to
> lower GC overhead".
Whereas we, working on a very limited hardware platform, need to be able
to limit Lua's memory usage absolutely; we pre-allocate a small block of
memory (currently about 60k), which we use exclusively for Lua. We do
this so that Lua's frequent requests for very small blocks of memory don't
cause memory fragmentation out in the heap.
When you only have 32 megabytes of RAM available, and load files that are
often as much as 18 megabytes in size, you get paranoid about heap
fragmentation very quickly. :)
We currently do this by explicitly resetting Lua's garbage collection
threshhold immediately after each call into Lua; that's the only way I
could find to keep Lua's garbage collection threshhold constant, since Lua
multiplies its gc threshhold by two every time it performs garbage
collection.
Trevor Powell