lua-users home
lua-l archive

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

I've already read the manual but my __gc function was only called when I quit the program or when I call collectgarbage manually. So there was a plenty waste of memory which was not freed.

Nav N Go Kft.
Bérc u. 23.
H-1016 Budapest

Nav N Go stands for innovative software for satellite navigation, mobile applications and content on a variety of platforms, enhanced by updates and online services delivered via Find out more about us at
This message, including attachments, is confidential and may be privileged. If you are not an intended recipient, please notify the sender then delete and destroy the original message and all copies. You should not copy, forward and/or disclose this message, in whole or in part, without permission of the sender.

From: [] On Behalf Of Rob Kendrick
Sent: 2009. május 5. 17:19
Subject: Re: GC

On Tue, 5 May 2009 16:52:25 +0200
Gergely BOROMISSZA <> wrote:

> I have some questions about Lua GC.
> As I can see Lua doesn't free up memory by garbage collecting, just
> marks it.

Lua uses a system called mark and sweep.  It will free memory without
you touching anything at all.

> Should I really call collectgarbage with parameter
> "collect" to do this manually or with parameter "step" continuously?
> Is there any possibility to do this automatically perhaps
> parameterized with a memory limit?

The manual is an excellent place to start; (from Lua) (from C)