lua-users home
lua-l archive

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


Peter Steiner wrote:
Julian Moore wrote:
On 6/23/07, Peter Steiner <pst@pnetz.org> wrote:

before i get my hands dirty with evaluation and testing, i would like to
ask of your experiences with long-term collector behaviour in LUA.


Firstly, Lua isn't an acronym. Secondly, this is very dependent on
your needs. If you need Lua to store data to disk and get it back
later that's very possible, just write a (rather simple) method of
converting your data to a string(or binary if you're feeling smart)
and save the data to disk.

If you mean keeping data stored as a variable in Lua, basically any
non-weak table is going to be there unless you set it to nil.

Of course I could be mis-interpreting your question ;)

thanks for your answer, but my question was concerning a different point:

i would like to know if the garbage collector of Lua is stable in the sense of memory usage over very long, and highly active, interpreter run times (i am talking in the magnitude of months) - from experience i know that many otherwise very mature interpreters suffer in this regard.

the popular reference applications like games etc. don't exercise long execution time, but my intended domain is in highly available server applications, where this is a given requirement.

i will stress test this behavior anyways, but i would like to know if others have experience in such applications of Lua...

regards,
peter.

I've successfully incorporated Lua in a (local) server environment and ran it for about nine months before the process was terminated for a server reboot. After the first few server requests were handled (so the memory was allocated), the memory footprint increased by about 5% in the rest of the total lifespan, which isn't much and probably could have been corrected by modifying my use of locals and log tables (I was only flushing the log every 100 requests or so, so the log messages would accumulate in a table, taking up memory). The server handled web requests for a test site I was developing, using various C libraries such as LuaSQL and LuaSocket.

As long as you use proper tables (weak when necessary, strong when necessary) and implement a fairly observant C malloc routine, you should be okay running Lua for extended periods of time. It's also important to watch any libraries you use for memory leaks, because third-party libraries have a tendency to do that sometimes.

--
Irayo