سؤال

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.

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top