lua-users home
lua-l archive

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


Thank you very much!

----- Original Message ----- 
From: "Leo Razoumov" <slonik.az@gmail.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Sunday, November 26, 2006 7:59 PM
Subject: Re: Lua need 1M memory?


> On 11/15/06, jason zhang <jzhang@sunrisetelecom.com.cn> wrote:
>> Thank you so much.
>> ----- Original Message -----
>> From: "Bennett Todd" <bet@rahul.net>
>> To: "Lua list" <lua@bazar2.conectiva.com.br>
>> Sent: Wednesday, November 15, 2006 10:51 PM
>> Subject: Re: Lua need 1M memory?
>>
> 
> I used another method to check how much physical memory (RSS memory in
> Linux) will be consumed by an additional Lua state with all standard
> libraries loaded.
> It turns out that it is just about 20KB (19.6KB in my tests on Linux).
> 
> Here is what I did. I took simple Lua stand-alone interpreter from
> PiL2 (Listing 24.1, page 219) and augmented it with N dummy Lua
> states. N is given as the only command line argument to the program.
> The source code of "luai" is attached to this message. A dummy state
> is created with luaL_newstate and all the standard libraries are
> loaded by means of luaL_openlibs. Then, I ran it with different number
> of "dummy" Lua states, let say "luai 0" and "luai 100" and checked RSS
> memory usage on Linux in each case. It gave me 19.6KB of resident
> physical memory per Lua state.
> 
> I think, this is remarkably low overhead. I can create 100 pthreads
> with individual Lua states in them at the memory cost of only 2MB.
> 
> --Leo--
>