[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua need 1M memory?
- From: Mike Pall <mikelu-0611@...>
- Date: Wed, 15 Nov 2006 02:57:49 +0100
jason zhang wrote:
> I think the overhead for shared library is "vmLib". "vmRSS"
> means the physical memory the process is using.
> Am I right?
Well, RSS counts shared and non-shared pages ... There is no
single, definitive indicator for the "memory use of a process" in
a modern OS with a complex virtual memory subsystem.
A somewhat related read:
> The simplest hello world C program use about 300K RSS memory.
> Others memory is for C runtime library. While Lua interpreter
> use 1M RSS memory.
ldd `which lua`
You may discover that Lua is linked with libreadline which drags
in quite a few other libraries. Don't forget about libm and
libdl, too. This and the fact that Lua initialization calls a
handful libc functions explains the difference. The latter adds
quite a few (shared) pages of libc to the RSS. The main memory
hogs are probably the libc memory allocator and stdio. Don't
blame this on Lua ...
Thankfully Lua allows you to drop most of these dependencies (if
you really need to). But I wouldn't bother on a desktop class
machine, because most of it is already in memory, anyway.