• 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: Returning structs of NSStrings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Returning structs of NSStrings


  • Subject: Re: Returning structs of NSStrings
  • From: Michael Becker <email@hidden>
  • Date: Thu, 25 Mar 2004 10:55:42 +0100

Am 25.03.2004 um 10:22 schrieb Michael Becker:
NSDatat *xmlData = [ network getUserXMLData]:
[ . . . ]
MyUser user;
user.name = [[ xmlContainer descriptionAtIndex:0] autorelease];
user.phone = [[ xmlContainer desciprtionAtIndex:0] autorelease];
user.street = [[ xmlContainer descriptionAtIndex:0] autorelease];

return user;


To my very surprise, this yields the following (for every "autoreleased" NSString):

*** malloc[2720]: error for object 0x398ed0: Double free

Removing the autorelease rids me of this error. Am I forgetting that the NSStrings returned by the xmlContainer object are most likely already autoreleased and thus I don't have to care?
I just don't want to leak memory, and much more important, don't want my app to crash with SIGBUS/SIGSERV etc.

Bye,
Michael
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Returning structs of NSStrings
      • From: Alastair Houghton <email@hidden>
    • Re: Returning structs of NSStrings
      • From: j o a r <email@hidden>
References: 
 >Returning structs of NSStrings (From: Michael Becker <email@hidden>)

  • Prev by Date: Re: Memory management question
  • Next by Date: Re: Returning structs of NSStrings
  • Previous by thread: Returning structs of NSStrings
  • Next by thread: Re: Returning structs of NSStrings
  • Index(es):
    • Date
    • Thread