As a bottom level base-line, looks like Corona is consuming about 80 KB just to get up and running.
Using the following in a blank folder with just a main.lua:
function checkMem()
print( collectgarbage("count") )
end
Runtime:addEventListener("enterFrame", checkMem)
… first line is ~ 80 KB, then climbs to a peak of 160 before the garbage collections kicks in and starts re-couping memory.
e.g.
83.0234375
83.1552734375
83.2900390625
83.4248046875
83.5595703125
83.6943359375
83.8291015625
…
159.9375
160.0673828125
160.203125
160.3349609375
160.470703125
158.4052734375
158.541015625
158.67578125
The GC continues to do it’s job and mem usage climbs down to about 90, then creeps back up to the 160 or more.
I suppose a timing mechanism (or when an array reach a cap or something like that) is part of the GC flow.
As I’m writing this post, I’m running the following:
local peak = 0
local ave = 0
local current = 0
local all = 0
local count = 1
local round = math.round
function checkMem()
--collectgarbage()
current = collectgarbage("count")
if current \> peak then peak = current end
all = all + current
ave = all / count
count = count + 1
print ("-------------")
print ("p: " .. round(peak))
print ("a: " .. round(ave))
print ("c: " .. round(current))
end
Runtime:addEventListener("enterFrame", checkMem)
… and it looks like it’s reporting:
-------------
p: 181
a: 136
c: 113
So, the bottom line is the Corona seems to consume an average of about 130 KB of memory as a “base level”, with a peak of about 180 KB.
So perhaps as a rule of thumb, we can safely say the “base level average” for a bare minimum app is around 150 KB (keeping a little cushion and making it easier to remember).
NOTE: The code above has the collectgarbage() function commented out. This enables automatic GC to occur. If the function is not commented out, as in:
function checkMem()
collectgarbage()
current = collectgarbage("count")
...
Then i’m getting the following:
-------------
p: 77
a: 77
c: 77
… Which indicates that the baseline memory usage for Corona is actually right around 80 KB. (Similar to the startup usage as noted at the top of this post.
So the scripts available in this post are kind of “real world” numbers, as rarely will a developer manually cause GC.
Perhaps the Corona moderators can weigh in on this particular matter?
[import]uid: 616 topic_id: 20090 reply_id: 79302[/import]