View Full Version : Lua garbage collecting in big "threaded" scripts.
spicejam
07-18-2013, 11:38 AM
Hello community,
as it is normal for huge and complex applications to use a garbage collector to save memory I have thought about using a garbage collector in scripts because they might get big as hell if you combine everything together and if you use modules.
Maybe someone already used garbage collecting? What do you think about it?
Lua garbage collection (http://lua-users.org/wiki/GarbageCollectionTutorial)
Syntax
07-18-2013, 03:40 PM
Hello community,
as it is normal for huge and complex applications to use a garbage collector to save memory I have thought about using a garbage collector in scripts because they might get big as hell if you combine everything together and if you use modules.
Maybe someone already used garbage collecting? What do you think about it?
Lua garbage collection (http://lua-users.org/wiki/GarbageCollectionTutorial)
There's no point, lua already does automatic garbage collection, you can call it yes, but there's hardly any point to.
Also, local variables are kept on the stack, so the GC won't free them.
Strings are recycled so there's no point there.
The only thing you can do memory wise is to make sure to recycle your tables, and not creating too many objects (functions inside while loops, etc)
dinmamma
07-18-2013, 03:54 PM
There's no point, lua already does automatic garbage collection, you can call it yes, but there's hardly any point to.
Also, local variables are kept on the stack, so the GC won't free them.
Strings are recycled so there's no point there.
The only thing you can do memory wise is to make sure to recycle your tables, and not creating too many objects (functions inside while loops, etc)
Recycling tables, would that be about the same as XB HUD does when changing characters? It cleans all the gathered data.
Syntax
07-18-2013, 04:26 PM
Recycling tables, would that be about the same as XB HUD does when changing characters? It cleans all the gathered data.
I'm sure it reuses resources, I don't know the details because I don't know hardly any C++ and have only seen bits of Nick's code.
In lua, the only thing you really need to worry about, memory wise, is recycling your tables.
spicejam
07-19-2013, 08:23 AM
Thanks Syntax sounds plausible :)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.