Stephen Leitnick
Stephen Leitnick

Reputation: 120

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.

Upvotes: 5

Views: 7543

Answers (1)

Dmitry Ledentsov
Dmitry Ledentsov

Reputation: 3660

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.

Upvotes: 7

Related Questions