lua-users home
lua-l archive

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


--- In lua-l@egroups.com, Edgar Toernig <froese@g...> wrote:
> Sebby wrote:
> > 
> > Basicaly, you'd need to split up the marking and the collecting
> > parts.
> 
> It's already split.  Just add marking of all stacks in markall.

Yeah, well that's kinda what i meant, for me i'd need to seperate the 
marking process from the collecting process so i can go through and 
mark all my threads. Should be trivial to do.

> > In my case it's somewhat easier since i set the gc limit
> > so it doesn't do automatic collection. Since i'd be using this for
> > video games, i don't want to have stalls due to gc at random 
points
> > in time, so i'll do the gc manually when i feel it will not cause 
any
> > speed issues (changing levels, opening up a menu, ...)
> 
> I hope you know what you're doing.  Delaying gc multiple minutes may
> generate a _huge_ heap if Lua is really used.  You have to program
> really careful with such long gc-delays (basically you have to avoid
> generating temporary objects).  It may be even better to call the gc
> every frame to have a pretty short gc-run.

Well, if i understand correctly the GC, everytime you run it (and the 
gc limit is reached), it goes through every used object to mark them 
then it goes through every object to collect thoes that haven't been 
marked. So, unless the actual cost of "freeing" an object is big, 
wouldn't the actual cost of GC be proprotional to the total number of 
objects not the number who would be collected?

But then i guess it's the kind of thing that is worth experimenting 
with. Worst case, i could put a fairly high limit (some maximum 
amount i'm willing to allocate for the heap) then regularly do GC and 
hopes that the actual collection doesn't happen too often. And i 
could also force a complete GC everytime the game does something non 
time critical.

Sebastien St-Laurent
Software Engineer, Z-Axis
sebby@z-axis.com


> 
> Ciao ET.