• 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: Does cocoa just leak?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does cocoa just leak?


  • Subject: Re: Does cocoa just leak?
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Sun, 30 Sep 2001 12:36:16 -0400

On Sunday, September 30, 2001, at 07:07 , j o a r wrote:

On Sunday, September 30, 2001, at 05:37 , Rosyna wrote:

This causes mem usage to go up about 500k. Thats not too bad, i guess. I set the URL thats returned to autorelease inside the class. However, doing:

for (i=0;i<5000;i++)
[[instance URL] path];

Causes the mem usage to go up to 5megs! thats a 4.5meg increase over "base"!

You think 5 MB is bad? I looped 6000 times over the "containsPoint:" method of NSBezierPath yesterday, and my application grew about 200 MB! You can imagine my surprise!
It turns out the whole path gets copied every time you call "containsPoint:". Simply inserting a local autorelease pool in my loop cured that problem though.

Why can't that autorelease pool be part of the framework, especially since that behaviour (duplicating the path) isn't documented? Is it not autoreleased per default for performance reasons?

It *is* autoreleased, that is why adding your own local NSAutoRelease pool helps. Although I do agree that it is odd that the entire path would be duplicated just to find out if it contains a given point. I would consider that a bug, and file it as such, since I can't see any reason that it couldn't be re-implemented without the copy, or any loss of speed.

--
Clark S. Cox, III
email@hidden
http://www.whereismyhead.com/clark/


  • Follow-Ups:
    • Re: Does cocoa just leak?
      • From: j o a r <email@hidden>
References: 
 >Re: Does cocoa just leak? (From: j o a r <email@hidden>)

  • Prev by Date: Re: Dare I fear the 10.1 upgrade?
  • Next by Date: Re: Dare I fear the 10.1 upgrade?
  • Previous by thread: Re: Does cocoa just leak?
  • Next by thread: Re: Does cocoa just leak?
  • Index(es):
    • Date
    • Thread