lua-users home
lua-l archive

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


> With Lua 64-bit it is not reproduced, but Lua eats enormous amount of
> memory.

> ./lua -e "local a = 'Name' for b = -1000, 0 do a = a .. '____________' 
> .. a .. '____________' .. a .. a .. '____________' end"

Well, lua should be erroring rather than overrunning.

But, you do realize that's actually _is_ trying to allocate an enormous
amount of memory?  After n passes through the loop, a will be
4*(4^n)+36*(((4^n)-1)/3) characters long: 4, 52, 244, 1012, 4084,
16372, etc.  After 1000 loops, this is approximately 1.84*10^603 bytes.
This is far more memory than all computers on the planet, put together,
have.  It is even far more bits than our best guess at the number of
subatomic particles in the observable universe (somewhere between 10^80
and 10^81).

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse@rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B