lua-users home
lua-l archive

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


> You said if your program stops long enough to collect garbage you could
> have a perceptible pause. I havent used Lua yet so I dont have any
> intuition about this. Will my program stop perceptibly to collect garbage?

The answer depends very much on what you do, but to provide a datapoint:

In the visualizer for our deformable model tracking application, we sometimes 
create hundreds of thousands of tables and other objects that represent the 
3D coordinates of a model, which are discarded after every frame, and thus 
are subject to garbage collection. Garbage collection latencies have never 
been a problem for us on P4s in the 1.5 to 2.4 GHz range. The user interface 
is very responsive, and if there is a pause in garbage collection, then we do 
not notice when it actually occurs. 

This is for tkLua, instead of wxLua, but I think it gives you the idea.

One thing to remember is that when you create hundreds of thousands of 
objects, they are usually the result of a lengthy calculation anyway. In this 
case, it is perfectly reasonable to force a GC manually as part of this 
creation process, and then no one will care whether the computations take 10 
seconds or 10 seconds plus 400 additional milliseconds for garbage 
collection. With a GUI application you don't tend to have hard realtime 
requirements anyway, where something *must* be processed at a very specific 
moment in time. You also have a good deal of control over when and how often 
garbage collections happen, and as I said, you can also force them manually 
in a quiet moment.

Honestly, I think that Lua GC latencies are of concern only to game 
programmers and other applications subject to realtime constraints. 

- Christian