Out of memory but heap shows about 5kb available
Posted: Wed Apr 08, 2015 8:08 pm
Hi,
I run this simple loop dumping lua memory usage and heap while filling an array with objects - very easy reproducible.
Why though does it run out of memory while still having about 5kb heap available? I'd have expected it to break at under 100 since each newly created object added to the collection uses only 48 bytes.
Any idea? Is this a bug?
pit
I run this simple loop dumping lua memory usage and heap while filling an array with objects - very easy reproducible.
Why though does it run out of memory while still having about 5kb heap available? I'd have expected it to break at under 100 since each newly created object added to the collection uses only 48 bytes.
Any idea? Is this a bug?
Code: Select all
> a={} for i=1,1000 do print(i,collectgarbage('count'),node.heap()) a[i]={} tmr.wdclr() end
1 5.2666015625 21664
2 5.3447265625 21528
3 5.3759765625 21480
...
256 17.2666015625 5056
257 17.2978515625 5008
258 17.3291015625 4960
not enough memory
pit