• 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
Re: NSString's "mutableCopy" creating a leak?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString's "mutableCopy" creating a leak?


  • Subject: Re: NSString's "mutableCopy" creating a leak?
  • From: "D.K. Johnston" <email@hidden>
  • Date: Wed, 1 Oct 2008 13:02:23 -0700

Where is editedRowName released?


On 1 Oct, 2008, at 12:34, Christopher J Kemsley wrote:

I'm writing a program that, in one table view, has the following code:

id receivedName = [theDatabase itemAtIndex:editedRow] ;
editedRowName = [receivedName mutableCopy] ;
[receivedName release];

where "editedRowName" is defined as an NSMutableString.



[theDatabase itemAtIndex:editedRow]

Asks my database to return item "editedRow." The object at that index is an NSString. For this function, the database would return


[theStringHere retain]



My code needs a mutable version of this string, so I make a mutableCopy of it and release the old one, as to prevent a memory leak.




However, when I do a "Run with performance tool: Leaks", it tells me that, ever time this part of the code runs, it leaks a "GeneralBlock-32" with the following information:

Category: CFString (store)
Event Type: Malloc
Responsible Library: Foundation
Responsible Caller: -[NSCFString mutableCopyWithZone:]




Does anybody know where this leak is coming from?



This is an Objective-C/Cocoa based application, compiling for the iPhone Simulator with the i386 architecture.
(Before anybody yells at me saying that the iPhone SDK cannot be discussed here, read this: http://developer.apple.com/iphone/ program/ )




-Christopher Kemsley
Sent from my Beautiful 17" MacBook Pro

_______________________________________________

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

================ D.K. Johnston 6-635 Battery Street Victoria BC V8V 1E6 (250) 381-0299


_______________________________________________

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


References: 
 >NSString's "mutableCopy" creating a leak? (From: Christopher J Kemsley <email@hidden>)

  • Prev by Date: Newbie: Simple display with NSView - problem
  • Next by Date: Re: NSString's "mutableCopy" creating a leak?
  • Previous by thread: Re: NSString's "mutableCopy" creating a leak?
  • Next by thread: Re: NSString's "mutableCopy" creating a leak?
  • Index(es):
    • Date
    • Thread