Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lua Table Memory?

This might be sort of a strange question, but curiosity got the best of me when I ended up getting a memory error after filling up a table with 14 million+ items.

Is there a sort-of set memory limit for Lua tables, or is it somewhat dynamic at all? I figured Lua itself would allocate so much memory in general, and the error would be thrown when that ran out, but that's just a wild guess. Anyone know for sure? Thanks.

like image 965
Stephen Leitnick Avatar asked Jul 10 '13 18:07

Stephen Leitnick


1 Answers

t={}
for i=1,176000000 do t[#t+1]=i end

Tried out with a lua windows 64 bit binary - works fine.

a large lua state

A 64 bit luajit binary crashed. Seems like a bug of luajit.

like image 161
Dmitry Ledentsov Avatar answered Nov 04 '22 18:11

Dmitry Ledentsov