lua-users home
lua-l archive

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


> > The idea is more that you only collect the "young" 
> generation most of 
> > the time (a "minor" collection), and then collect the "old" 
> generation 
> > when you're really running out of heap (a "major" collection).
> 
> I was a little off on what I thought generational meant, 
> thanks for the clarification. This sounds basically like my 
> const data idea, I guess the only difference would be that I 
> was proposing that the user would give the GC a hint about 
> where "old" ends and "young" begins.
> 
> what I think its going to do. The other is that operations 
> that would seemingly create no new memory, actually do. At 
> least, Lua updates its "rough approximation of used memory."

Amped just got hit by the lua_newuserdatabox() allocation in Lua 4.1
Alpha.  This wasn't a problem before, I'm pretty sure, but the new
semantics of user data made it so.  A simple function call that passed a
user data value to Lua and was called quite a few times per frame caused
frame rates to drop considerably because of all the allocations going
on.  I was able to remedy the problem, but it certainly wasn't a place I
expected an allocation.

> Hopefully!
> This would require some serious looking at. Many games allow 
> up to hours of continuous gameplay. However, in practice most 
> people at least Save once in a while, or pause to take a 
> bathroom break. Other games, such as Amped, could probably 
> make a large estimate of 10-20 minutes before the user stops boarding.

Thankfully, the in-game portion of Amped that uses Lua is very, very
careful about anything that allocates memory (read: it rarely, if ever,
happens).  Still, though, I could have scripted more of Amped if I
wasn't so paranoid about the garbage collection process.

Thanks,
Joshua Jensen
Amped: Freestyle Snowboarding 
http://www.xbox.com/Games/sports/amped.htm