Re: Does cocoa just leak?
Re: Does cocoa just leak?
- Subject: Re: Does cocoa just leak?
- From: j o a r <email@hidden>
- Date: Sun, 30 Sep 2001 22:07:16 +0200
On Sunday, September 30, 2001, at 06:36 , Clark S. Cox III wrote:
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.
Sorry, I ment to say "why don't they release their autoreleased objects".
On Sunday, September 30, 2001, at 08:34 , John Hvrnkvist wrote:
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.
This is what ObjectAlloc tells me about one of the allocations. It does
seem like it uses "bezierPathByFlatteningPath" - it seemed to me like a
class method to return a new path - that 's why I said it copied the
path. Perhaps it isn't so?
You are absolutely right about it requiring a lot of resources though
John - is there an alternative way to obtain the x position on a path
given a known y-position? It takes way to long time as it is now. I was
never very good at math in school, mind you... ;)
j o a r
Event: (#67873) AllocationEvent
Time Index: 23563204.481593
Category: NSBezierPath
Pointer: 0x2acea60 Size: 94
Thread: 0x703 Extra Data: 0x0
Backtrace:
_internal_class_createInstanceFromZone
NSAllocateObject
+[NSObject allocWithZone:]
+[NSObject alloc]
-[NSBezierPath bezierPathByFlatteningPath]
-[NSBezierPath _locationOfPoint:]
-[NSBezierPath containsPoint:]
...