• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
memory leak in readInBackgroundAndNotify
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memory leak in readInBackgroundAndNotify


  • Subject: memory leak in readInBackgroundAndNotify
  • From: "Gurmit Teotia" <email@hidden>
  • Date: Tue, 18 Apr 2006 20:25:07 +0530

Hi All,



I have created a GUI application in Cocoa. I'm using the NSFileHandle's
readInBackgroundAndNotify method to read the data from socket. Data
receiving method is something like this:-



-(void) receivedData: (NSNotification *) notification

{

            NSData *data=[[notification userInfo] objectForKey:
NSFileHandleNotificationDataItem];

            NSString *mData=[NSString stringWithUTF8String:[ data bytes];



            .. do something with mData



            [fileHandle readInBackgroundAndNotify];



}



In above method "mData" is not released which results in increased memory
footprint of application. I'm wondering in which autorelease pool "mData" is
allocated? ObjectAlloc program is only showing one instance of
NSAutoreleasePool.



If I create a new NSAutoreleasePool object at entry point of method and
release it at exit point then no memory leaks happen.

Could any one please explain me this behaviour? I'm also new to Cocoa
development.



Regards,



Gurmit
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: memory leak in readInBackgroundAndNotify
      • From: "Gurmit Teotia" <email@hidden>
  • Prev by Date: Re: NSMetaDataQuery crash: __NSMetadataCreateResult + 116
  • Next by Date: Best Cocoa Books
  • Previous by thread: HTTPS and Web Services Core
  • Next by thread: Re: memory leak in readInBackgroundAndNotify
  • Index(es):
    • Date
    • Thread