[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: .. garbage collection...
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 02 Feb 2001 11:23:15 -0200
> Hi I'm fairly new to lua and just had a quick question for you guys. I'm
> running a single lua state with a bunch of precompiled small lua scripts.
> Now the problem I had was that a single script never went anywhere close
> the default garbage collection threshold. When running another script
> though the threshold was bumped up once again, this eventually cascades
> until I'm out of memory (small memory model constraints for what I'm doing).
Yeah, this is a tricky bug. When we compile a chunk, we add the memory
used by its code to the threshold, because usually this is not garbage;
we then avoid useless GC cicles. But in your case, you keep running new
chunks over and over, and those chunks do not use any extra memory!
So, the counter nblocks never gets GCthreshold...
One solution to this problem can be to remove this "optimization";
another (maybe better) is to add only a fraction of the code, for
instance to change ldo:252 to
L->GCthreshold += (L->nblocks - old_blocks)/2;