ASIHTTPRequest: Potential memory in EditSiteViewConroller leak
Hey there, I really apologize if I got this wrong, but I think that there's a memory leak in EditSiteViewController.m on line 300: http://ios.trac.wordpress.org/browser/trunk/Classes/EditSiteViewController.m#L300
ASIHTTPRequestobject is set the
allocmessage but never receives a
autoreleasemessage. Unfortunately I was unable to test this out with Instruments since the app just crashes when profiled (although works fine when simply running) but I did test it out in my own application where I use
ASIHTTPRequestto grab thumbnail images from my blog. Had it leaking like crazy until I added an
[request release]right after
Also I'm not sure whether the autorelease pool is necessary there, I don't see any allocations and autoreleases to be drained by the pool so it might be redundant.
I also looked for other places and spotted the usage of
[ASIHTTPRequest alloc]and found another potential leak in WPDataController. Let me know if you want me to test this out, I can submit a patch to fix them both.
You're right, thanks. I can fix that one, but patches are very welcome :)
The autorelease pool is needed since that method is called on a background thread. The strings used on
urlToValidateare autoreleased and should be handled by an autorelease pool.
The crash when profiling is really weird, and I haven't experienced it. Can you get a crash report for that?
Opened a trac ticket right here http://ios.trac.wordpress.org/ticket/895 trying to get a crash report from Instruments, I'm quite new to this so hang in there ;)
Okay got some more info. It's working fine on the 4.3 simulator but crashes when I launch 4.2 for leaks. The activity monitor works though and seems like all the other modules from the library too. As soon as I drop the Allocations module to the list the app runs for 4-5 seconds and then crashes, can't seem to find any crash report.
Anyways, I did the leaks profiling on 4.3 so yeh, there was an ASIHTTPRequest leak every time you add a new site, worth around 1kb. I've done it three times and here's the result http://twitpic.com/5q0lwy , so the patch I submitted got rid of that, hurray!
I applied your patch :)
As for the crash report, it should be in Xcode's organizer: Devices -> <device_name> -> Device Logs
Thanks for contributing!
mrroundhill, no problem
Jorge, thanks for the props. I can't find the iOS simulator in the devices section, only physical devices. The device logs section (not under devices) shows some logs, not sure where they're from, but WordPress is not listed in the applications list. I'd test it on my real devices, but they're both 4.3 and above and I'm having the crash with Instruments on 4.2.
This topic has been closed to new replies.