Memory leak by CFNetwork?

6 Comments 30th OCT 2009 | Posted by Ivan Kalaica in iPhone development

Memory leak by CFNetwork?

It’s been a while since I wrote my last post. Since then I got married, completed faculty, finished three iPhone applications for clients and three internal. Well, these are the main reasons for my absence and I think they are justified. :)

Now lets get back on memory leak issue created by CFNetwork class. If you create NSURLConnection object you will get this memory leak. First time I meet with this issue I was thinking it was my fault as developer, but when I tracked leak I realized that memory leak is created by framework internally. Instruments tool says clearly – “Responsible caller – CFNetwork”.

Well, this is my own conclusion and I might not be right but considering all given facts the leak is created by CFNetwork class. Also, I am not only one developer that has same issue. Many of iPhone developers has complain on same memory leak created by CFNetwork class. To solve this issue I try to put autoreleas pool like code below but no luck.

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

[pool release];

Also I tried to create NSURLCache object like code below but no luck.

NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
[sharedCache release];

If any of you has meet similar issue or maybe has solution for this memory leak please leave comment bellow. Thanks! :)

If you like what you read, please share it.

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Yahoo! Bookmarks
  • Reddit
  • Technorati
  • Twitter
  • StumbleUpon
  • LinkedIn
  • Netvibes
  • FriendFeed
  • NewsVine
  • Sphinn
  • Tumblr

There are 6 comments (Add Yours +)

  • Toni Anicic Says

    “It’s been a while since I wrote my last post. Since then I got married, completed faculty, finished three iPhone applications for clients and three internal.” – Golden quote! :D

    So your last post was like a month ago? :D

  • Congratulations Ivan for all of those good things. :)

  • Ivan Kalaica Says

    Well, something like that… Am I fast or what?! :)
    Thanks!

  • Flash Gordon of iPhone development!

  • David Zemsky Says

    Thanks for sharing this, now I don’t feel that bad about my app :-) . I am profiling my iPhone app with Instruments now and getting the same leaks (in NSURLCache), except that it is when using UIWebView. With almost no code from my side, it leaks memory, when browsing.

  • Ivan Kalaica Says

    It’s not interesting if everything works perfect… ;)

Leave a Comment

Magento Design and Development | Magento SEO | iPhone Application Development Web Application Development with ZEND | WordPress Ecommerce | WordPress development
Sitemap

Inchoo - webappsolutions | 2009