lua-users home
lua-l archive

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


All,

This is not a problem or big concern, but I'm curious about how memory
management and garbage collection works with Lua in a Windows
environment.  This may be more of a Windows issue than a Lua one - I
don't know, but I figure somebody here can set me straight pretty
quickly.

I've got a script that does some very specific types of code analysis
on C# projects.  In one particular case, it scans almost 900,000 lines
of code in over 4400 files and builds tables of functions, calls, etc.

I noticed that when viewing memory usage for the script in Windows
Task Manager, memory usage climbed to a couple hundred MB and seemed
to stay there even after the tables were disposed of. I turned the
program into a console program that prompts for a code directory and
clears all tables before it waits for another directory to scan. The
program can sit at the prompt waiting for input for days and the
memory usage doesn't go down.

I added a collectgarbage("count"), collectgarbage("collect"), and
another collectgarbage("count") right after disposing of the tables,
and it does indeed report that the garbage collection disposed of a
huge amount of memory, but the memory usage reported in Task Manager
doesn't change, no matter how long it sits idle after the garbage
collection.

Is this perhaps because Windows just isn't bothering to reclaim it or
an indication of something else going on?

Thanks,

Mark