lua-users home
lua-l archive

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

John Belmonte wrote:
> If it is a graphics app why not just call collectgarbage() once per frame to 
> force collection? 

That works, but doing a gc run is an expensive operation. 
> Nicolas Devillard wrote: 
> > I have a defined a userdata type (an image) that holds large quantities of 
> > memory. Obviously, this data type should be garbage collected as soon as 
> > possible to release resources. 

The lua gc has a memory limit that you can set with the collectgarbage() function. 
When it reaches it, it does a gc run. You might try setting this to be at the amount 
of memory that you find acceptable for your program to take.