• 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
Inconsistent Memory Management Rules
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inconsistent Memory Management Rules


  • Subject: Inconsistent Memory Management Rules
  • From: David Blanton <email@hidden>
  • Date: Sun, 13 Apr 2003 12:54:42 -0600

I have an example that contradicts the rules I have read for Cocoa memory
management.

One rule as I understand it is "If you -alloc, then you -release (or
-autorelease)"

I have code that crashes when using this rule as follows:

NSString * string = [[NSString alloc]init];
string = [string stringByAppendingString:@"steve jobs"];

... More of the same

[anIBOutlet setStringValue:string];
[string release]; // always crashes

Can someone explain this inconsistency?

--
David Blanton
"Cocoa FNG"
_______________________________________________
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: Inconsistent Memory Management Rules
      • From: "Jean-Olivier Lanctôt-D." <email@hidden>
    • Re: Inconsistent Memory Management Rules
      • From: "John C. Randolph" <email@hidden>
    • Re: Inconsistent Memory Management Rules
      • From: Sherm Pendley <email@hidden>
    • Re: Inconsistent Memory Management Rules
      • From: Lloyd Dupont <email@hidden>
    • Re: Inconsistent Memory Management Rules
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: about install_name_tool
  • Next by Date: Re: Language tags
  • Previous by thread: Re: gdb question
  • Next by thread: Re: Inconsistent Memory Management Rules
  • Index(es):
    • Date
    • Thread