The Problem
setInterval leaks objects (and memory) on iOS. Even without anything in it, this can still be observed.
Sample Code
If you are feeling particularly adventurous, lower the period of the below code to 1 instead of 30. It will increase the rate of the leak and slow your computer down a bit, but the same behavior can be observed at higher periods such as 30 or 200. I did not test on anything longer than 200.
function checkInterval() { }
setInterval(checkInterval, 30);
I ran the above code alone in an app.js using XCode's "Profile" > "Allocations" feature. It leaks at a rate of approximately 100 CFStrings, 100 CFDates, and 30ish KrollInvocations per second.
Associated Helpdesk Ticket
There isn't one. I noticed this in one of our co-dev apps.
Timers, when running, keep the meter running on autorelease pools. This adds a new autorelease pool to stop that.
Verified fixed with SDK build r364c307e. Verified leak prior to verifying fix. With fix memory allocation stayed stable on iOS 4.3.3 with iPhone 4. Closing.