Is this bad memory usage?

Using this script

 local monitorMem = function() collectgarbage("collect") print( "\nMemUsage: " .. collectgarbage("count") ) local textMem = system.getInfo( "textureMemoryUsed" ) / 1000000 print( "TexMem: " .. textMem ) end local memTimer = timer.performWithDelay(1000, monitorMem, -1)

It is printing out

MemUsage: 398.9365234375

TexMem: 76.768092

how bad is the memory/texture usage?

That would be totally relative to what you’re doing, however those numbers are not too large to run on most devices.  

One thing that is weird however is the low texture memory usage and high main memory usage.  You must have captured that at a time when you were not drawing many images.

What would be the borderline amount the numbers should be at?

I really don’t know what you mean.  Borderline for what?  iPhone 6+?  Nexus 7 (gen 1)?  What?

Decide on your target device pool then find the one(s) with the least amount of memory. That is your borderline as you call it.

Remember the garbagecollect memory is in Kilobytes (KB). You’re using 398,936 bytes of system memory. This is memory from the tables and strings for the objects you’ve created.

Texture memory is returned in bytes. You’re dividing by 1,000,000 to convert to megabytes (MB) which is 1000x greater than a KB. You should be dividing by (1024 * 1024) to be 100% accurate. Since computers run on powers of two, this isn’t a “metric” mega meaning 1 million but a computer mega 2^20 or 1,048,576.  But the divide by 1,000,000 is close enough. You’re using 76.7 megabytes of texture memory. Most modern devices should be able to handle that.

There are no hard numbers to say where to keep it under since it’s very dependent on the hardware, how much memory it has, how much multi-tasking is going on with other processes and so on.  Keeping your total memory footprint under 150mb would seem wise. You should be able to get that on most modern devices.

Rob

That would be totally relative to what you’re doing, however those numbers are not too large to run on most devices.  

One thing that is weird however is the low texture memory usage and high main memory usage.  You must have captured that at a time when you were not drawing many images.

What would be the borderline amount the numbers should be at?

I really don’t know what you mean.  Borderline for what?  iPhone 6+?  Nexus 7 (gen 1)?  What?

Decide on your target device pool then find the one(s) with the least amount of memory. That is your borderline as you call it.

Remember the garbagecollect memory is in Kilobytes (KB). You’re using 398,936 bytes of system memory. This is memory from the tables and strings for the objects you’ve created.

Texture memory is returned in bytes. You’re dividing by 1,000,000 to convert to megabytes (MB) which is 1000x greater than a KB. You should be dividing by (1024 * 1024) to be 100% accurate. Since computers run on powers of two, this isn’t a “metric” mega meaning 1 million but a computer mega 2^20 or 1,048,576.  But the divide by 1,000,000 is close enough. You’re using 76.7 megabytes of texture memory. Most modern devices should be able to handle that.

There are no hard numbers to say where to keep it under since it’s very dependent on the hardware, how much memory it has, how much multi-tasking is going on with other processes and so on.  Keeping your total memory footprint under 150mb would seem wise. You should be able to get that on most modern devices.

Rob