memory overheads

Hi, I’m just dealing with memory leaks and whatnot and at the moment…from start menu to playing a level back to start menu my leak stands at about 50k…yup, I know…but I’m working on it.

But, what I’m more concerned about is how much memory I’m using anyway.

MEMORY = 3516.415 KB TEXTURE MEMORY= 69.803043365479

Is this way too much? I’m certainly experiencing some ‘chugging’ when running it on my 5g iPhone, and 2g iPad.

Many thanks for any responses.

I don’t think a difference of 50K is a leak.

Lua memory management doesn’t always go back to the value you were at.

What you should really worry about is memory usage that climbs and never comes down.

Or, in your example:

  • Baseline memory
  • Start -> Play -> Start
  • Baseline + 50 
  • Start -> Play -> Start
  • Baseline + 100 
  • Start -> Play -> Start
  • Baseline + 150 

Now you may have a leak.  This on the other hand is not a leak:

  • Baseline memory
  • Start -> Play -> Start
  • Baseline + 50 
  • Start -> Play -> Start
  • Baseline + 50 
  • Start -> Play -> Start
  • Baseline + 50 

RE: Chugging.  First not a great description (could be caused by a number of things), but I get your point.

You need to measure frame rate and memory usage over time, etc. 

There are tools for this.  

Check out the 3rd party tools: https://coronalabs.com/resources/3rd-party-tools-and-services/  (I can’t link my site or tools directly, but you can find them on the 3rd party page.)

Also, M.Y. Developer has a profiler: http://www.mydevelopersgames.com/profiler.html

Oh, and forgot to answer question about memory.  3.5MB main memory used is NOT too much.  You can use up to 128MB before you even have to worry on most devices and on later iOS devces much much more.

Ex:

iPhone 5* - Worry when near 512 MB 

iPad 3 - Worry when near 1GB 

(I worry a bit lower, but crashes will almost surely occur at this point)

I don’t think a difference of 50K is a leak.

Lua memory management doesn’t always go back to the value you were at.

What you should really worry about is memory usage that climbs and never comes down.

Or, in your example:

  • Baseline memory
  • Start -> Play -> Start
  • Baseline + 50 
  • Start -> Play -> Start
  • Baseline + 100 
  • Start -> Play -> Start
  • Baseline + 150 

Now you may have a leak.  This on the other hand is not a leak:

  • Baseline memory
  • Start -> Play -> Start
  • Baseline + 50 
  • Start -> Play -> Start
  • Baseline + 50 
  • Start -> Play -> Start
  • Baseline + 50 

RE: Chugging.  First not a great description (could be caused by a number of things), but I get your point.

You need to measure frame rate and memory usage over time, etc. 

There are tools for this.  

Check out the 3rd party tools: https://coronalabs.com/resources/3rd-party-tools-and-services/  (I can’t link my site or tools directly, but you can find them on the 3rd party page.)

Also, M.Y. Developer has a profiler: http://www.mydevelopersgames.com/profiler.html

Oh, and forgot to answer question about memory.  3.5MB main memory used is NOT too much.  You can use up to 128MB before you even have to worry on most devices and on later iOS devces much much more.

Ex:

iPhone 5* - Worry when near 512 MB 

iPad 3 - Worry when near 1GB 

(I worry a bit lower, but crashes will almost surely occur at this point)