collectgarbage(“count”) returns the memory being used by Lua. This is for tables, strings, etc. It’s usually a value in the 100,000’s of bytes order and for some apps, it might climb to a megabyte or two. Generally speaking Lua memory is less than a single image loaded as a background (texture memory). Texture memory is the memory used by your graphics. The API to get that is:
system.getInfo(“textureMemoryUsed”) (https://docs.coronalabs.com/api/library/system/getInfo.html#texturememoryused)
This returns the amount of memory in bytes used by graphics and images. Divide it by (1024*1024) to convert it to Megabytes which is a more useful value to look at. FWIW, collectgarbage(“count”) returns the memory in “Kbytes”. If you want to see that value on the same scale as your texture memory, divide by 1024, though honestly, kbytes is a good scale for that since you’re generally dealing with several hundred kbytes of Lua memory. Most people don’t want to deal with 7+ digits of for texture memory, which is why I recommend converting to MegaBytes first.
Anyway, if you’re not looking at texture memory, that would be a great place to start. Your device (and simulator) are rarely going to run low on memory due to Lua memory usage, texture memory usage is where you’re going to start pushing your device’s limits. You might find on some devices you might only have 50mb of memory available to you. Modern devices could get you a few hundred megabytes of memory to use.
Finally, check to make sure to check your audio. There isn’t a way to measure how much memory audio is taking up, but it can be a sizable drain too.
Rob