Garbage Collection Times?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Garbage Collection Times?

davidgu
Hi,

Several who have tried to use Lua for real-time programs have stated 
as one of Lua's "short commings", it's garabge collection cycle. This 
cycle could happen at any time and could lead to noticable "blips" 
during program execution.

My question is, for those who have come up against this, how long 
have you found Lua's GC cycle to take? Fractions of a second? Seconds?

My Lua programs are all quite small thus far, but I'm curious, as 
they get bigger and more complex, what kind of "blips" I can expect.

Also, is it ok to set the GC threshold very high, so Lua will never 
perform a GC cycle, then set the threshold to zero('0') to forces a 
GC cycle, then reset it to very high?

Thanks,
David


Reply | Threaded
Open this post in threaded view
|

Re: Garbage Collection Times?

John Belmonte-2
Hello,

[hidden email] wrote:
> My question is, for those who have come up against this,
> how long have you found Lua's GC cycle to take? Fractions
> of a second? Seconds?

This depends on program size, execution profile, cpu power, and so on.  For
an average program on an average machine, certainly a small fraction of a
second.

> Also, is it ok to set the GC threshold very high, so Lua will
> never  perform a GC cycle, then set the threshold to zero('0')
> to forces a  GC cycle, then reset it to very high?

Forcing gc cycles is possible and easy, that's not the problem.  The issue
is if your app is of a hard real-time nature and you can't afford to give up
control to the gc for the duration of a cycle.

-John