• 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: Reading return values from NSTask
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading return values from NSTask


  • Subject: Re: Reading return values from NSTask
  • From: Shawn Erickson <email@hidden>
  • Date: Mon, 29 Dec 2003 21:25:25 -0800

On Dec 29, 2003, at 9:16 PM, KLW wrote:

Shawn,

Thanks for your help, as well as for pointing out some of the memory allocation and initialization flaws in my code. I have assigned myself the task on rereading those sections in my two books. I still feel quite lost on that subject.

Glad I could help.

[snip]

data = [[[perlControl standardOutput] fileHandleForReading] availableData];
if ((data != nil) && [data length]) {
result = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
}
[data release];

[snip]

You do not need to release data since you didn't allocate it (you didn't use alloc, copy or mutableCopy). I bet that is causing your crash later in your application when the current autorelease pool is deallocated.

Cheers,
-Shawn
_______________________________________________
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.

References: 
 >genstrings not working (From: David Kocher <email@hidden>)
 >Re: genstrings not working (From: "Louis C. Sacha" <email@hidden>)
 >Reading return values from NSTask (From: KLW <email@hidden>)
 >Re: Reading return values from NSTask (From: Shawn Erickson <email@hidden>)
 >Re: Reading return values from NSTask (From: KLW <email@hidden>)

  • Prev by Date: Re: Making Localizable Help Folder with Xcode
  • Next by Date: Re: File sizes when NSImage's are included
  • Previous by thread: Re: Reading return values from NSTask
  • Next by thread: reloading individual rows in tableview
  • Index(es):
    • Date
    • Thread