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

NSString's "mutableCopy" creating a leak?


  • Subject: NSString's "mutableCopy" creating a leak?
  • From: Christopher J Kemsley <email@hidden>
  • Date: Wed, 1 Oct 2008 12:34:35 -0700

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


  • Follow-Ups:
    • Re: NSString's "mutableCopy" creating a leak?
      • From: Brian Stern <email@hidden>
    • Re: NSString's "mutableCopy" creating a leak?
      • From: "D.K. Johnston" <email@hidden>
    • Re: NSString's "mutableCopy" creating a leak?
      • From: Corbin Dunn <email@hidden>
    • Re: NSString's "mutableCopy" creating a leak?
      • From: "I. Savant" <email@hidden>
    • Re: NSString's "mutableCopy" creating a leak?
      • From: "Sherm Pendley" <email@hidden>
    • Re: NSString's "mutableCopy" creating a leak?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Play Playlist in iTunes
  • Next by Date: Re: Finding other apps' paths - deterministically!
  • Previous by thread: Re: Cocoa Programming iPing exercise
  • Next by thread: Re: NSString's "mutableCopy" creating a leak?
  • Index(es):
    • Date
    • Thread