Skip to main content
Inspiring
March 19, 2012
Answered

Tracking Memory usage on iOS using the Stats class

  • March 19, 2012
  • 1 reply
  • 1487 views

I've been checking memory usage on an app I'm developing for iOS using the Stats class https://github.com/mrdoob/Hi-ReS-Stats ( http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c3-315cd077124319488fd-7fff.html#WS948100b6829bd5a61637f0a412623fd0543-8000).

I added the Stats class to my project and redeployed and, yikes, memory usage reported in Stats creeps up (pretty slowly) even when there's nothing happening in the app (just showing a loaded bitmap).

To try and track down the issue I created a project with a test class that extends Sprite with just this single call in the constructor :-

addChild( new Stats() );

I deployed it to the device to check that it didn't gobble any memory.

But I was Suprised to watch the memory usage creep up and up (to approx 5) before some garbage collection kicked in and takes memory back down. I left it running and then it crept up again to over 7.5 this time before being kicked back down to just below 3.

So 2 related questions that I'd appreciate any feedback/observations/thoughts on :-

1 - Is this normal (i.e. memory creeping up when there's nothing other than Stats in the project) ?

2 - What is the best way to monitor memory usage within an app ? Is Stats good enough - is Stats itself causing the memory usage ?

All the best guys !

This topic has been closed for replies.
Correct answer FingersCrossed

Also see thread (http://forums.adobe.com/message/4280020#4280020)

My conclusions are :-

- If you run an app and leave it idle, memory usage gradually creeps up (presumably as memory is being used to perform calcs/refresh the display etc)

- Periodically the garbage collection kicks in and memory is brought back down

- This cycle could be in excess of 5 mins

Run with your real app and memory will increase and be released much more rapidly/regularly.

- It's probably worth performing initial checks by running on your desktop to iron out any initial problems

1 reply

FingersCrossedAuthorCorrect answer
Inspiring
March 22, 2012

Also see thread (http://forums.adobe.com/message/4280020#4280020)

My conclusions are :-

- If you run an app and leave it idle, memory usage gradually creeps up (presumably as memory is being used to perform calcs/refresh the display etc)

- Periodically the garbage collection kicks in and memory is brought back down

- This cycle could be in excess of 5 mins

Run with your real app and memory will increase and be released much more rapidly/regularly.

- It's probably worth performing initial checks by running on your desktop to iron out any initial problems