XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 5 of 5

Thread: Lua garbage collecting in big "threaded" scripts.

  1. #1
    Lifetime Subscriber spicejam's Avatar
    Join Date
    Apr 2012
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lua garbage collecting in big "threaded" scripts.

    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
    Last edited by spicejam; 07-18-2013 at 11:40 AM. Reason: added link

  2. #2
    XenoBot Scripts Developer Syntax's Avatar
    Join Date
    Feb 2011
    Posts
    1,658
    Mentioned
    431 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by spicejam View Post
    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
    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)

  3. #3
    Senior Member
    Join Date
    Sep 2012
    Posts
    1,070
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Syntax View Post
    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.

  4. #4
    XenoBot Scripts Developer Syntax's Avatar
    Join Date
    Feb 2011
    Posts
    1,658
    Mentioned
    431 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by dinmamma View Post
    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.

  5. #5
    Lifetime Subscriber spicejam's Avatar
    Join Date
    Apr 2012
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Syntax sounds plausible

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •