lua-users home
lua-l archive

Re: Problems with large integer arrays

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


>With Lua 4.0, I can create an array with, say, 20,000 nunbers just
>fine. If I increase to 30,000 numbers the program takes a long time
>and also increases memory size to 15 MB or so.
>
>Wierd eh?
Yes. It does not happen in my machine (Linux with 128Mb RAM):
% cat i
n = n or 20000
local a={}
for i=1,n do a[i]=i end
execute"ps ufx"
% lua -v n=90000 i
Lua 4.0 Copyright (C) 1994-2000 TeCGraf, PUC-Rio
USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND
lhf 4642 0.0 0.8 1572 1068 p1 S 13:56 0:00 -csh 
lhf 4722 0.0 3.1 4508 4056 p1 S 14:00 0:00 \_ lua -v n 90000 i
lhf 4723 0.0 0.4 928 592 p1 R 14:00 0:00 \_ ps ufx 
With 90,000 numbers, it's still only 4.5 Mb.
--lhf

AltStyle によって変換されたページ (->オリジナル) /