Lua table memory?

This may be a kind of weird question, but curiosity got better than me when I got a memory error after populating a table with 14 million + elements.

Is there any limited memory boundary for Lua tables or is it dynamic at all? I figured that Lua itself would allocate so much memory in general, and the error would be thrown when it ends, but this is just a wild hunch. Does anyone know for sure? Thanks.

+4
source share
1 answer
t={} for i=1,176000000 do t[#t+1]=i end 

I tried a 64-bit binary with lua windows - it works fine.

a large lua state

The lujit 64-bit binary error crashed. Sounds like a luajit error.

+5
source

Source: https://habr.com/ru/post/1490776/


All Articles