Re: Puzzling memory creep
Re: Puzzling memory creep
- Subject: Re: Puzzling memory creep
- From: Quincey Morris <email@hidden>
- Date: Sat, 05 Sep 2015 21:55:03 +0000
On Sep 5, 2015, at 13:41 , Richard Kennaway <email@hidden> wrote:
>
> With a timer interval of 0.01, the MacBook Pro shows about 2 new 32-byte allocations per second, and the iMac shows about 100 per second.
I repeated the test, with that smaller interval, and yes I can see a very slow increase in #Persistent, but not in a similar pattern to what you saw. I ran for about 20 minutes, and the *last* increase I saw occurred about the 11-minute mark. The total increase, after the first couple of thousand ticks, was about half a dozen objects.
It’s very doubtful to call what I saw a leak. It could easily have been growth of a cache. At that rate, the cache might only need to be emptied every few *days* — less, in “real” life, since the test is an artificial pattern of app behavior.
You can, and should, submit a bug report, since you have a clear behavior and a test project to reproduce it.
I’m not sure there is much else that you can usefully do. If your app is supposed to be (in effect) counting seconds over the long term and you don’t want it to crash, you can perhaps form an estimate of how long it might be expected to run, by using your 100-fold speed increase and letting it run until that crashes, if ever. Multiply the time it ran by 100. (But it’s meaningless to do this in the simulator. You’d need to use an actual iOS device.)
If the memory increase is intolerable, you could try using something other than a NSTimer (e.g. a GCD timer, or some asynchronous API that has a timeout). Other than that, you may just have to let go of it.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden