Re: Does cocoa just leak?
Re: Does cocoa just leak?
- Subject: Re: Does cocoa just leak?
- From: John Hörnkvist <email@hidden>
- Date: Sun, 30 Sep 2001 20:34:00 +0200
On Sunday, September 30, 2001, at 01:07 PM, j o a r wrote:
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's quite possible that NSBezierPath calls "bezierPathByFlatteningPath"
in that code and solves each generated line segment for the point.
Flattening will eat lots of memory for complex paths.
Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com