• 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: Memory Management issue?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory Management issue?


  • Subject: Re: Memory Management issue?
  • From: Nick Zitzmann <email@hidden>
  • Date: Sat, 24 Sep 2005 09:16:41 -0600


On Sep 24, 2005, at 9:06 AM, Aaron Wallis wrote:

        // create a url for the file
        NSURL * scriptURL = [[ NSURL alloc ] init];

Here you're wasting memory by creating a completely blank immutable URL.

scriptURL = [NSURL fileURLWithPath: [NSString stringWithString:scriptPath]];

Here you're overwriting the pointer pointing to the blank URL with an autoreleased URL that points to a file.


        // release the path
        [ scriptPath release ];

Here you're releasing the autoreleased URL you created earlier. This will lead to a crash, since the autorelease pool will now try to release something that has already been released.


Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Memory Management issue? (From: Aaron Wallis <email@hidden>)

  • Prev by Date: Re: zip compression/decompression SDK
  • Next by Date: Re: Memory Management issue?
  • Previous by thread: Memory Management issue?
  • Next by thread: Re: Memory Management issue?
  • Index(es):
    • Date
    • Thread