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.
Bleki



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

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 http://www.naviextras.com/. Find out more about us at http://www.navngo.com/.
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: lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Rob Kendrick
Sent: 2009. május 5. 17:19
To: lua@bazar2.conectiva.com.br
Subject: Re: GC

On Tue, 5 May 2009 16:52:25 +0200
Gergely BOROMISSZA <Gergely.BOROMISSZA@navngo.com> 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;

http://www.lua.org/manual/5.1/manual.html#pdf-collectgarbage (from Lua)
http://www.lua.org/manual/5.1/manual.html#lua_gc (from C)

B.