 |
 |
representationUsingType:properties: memory leak?
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
Can someone check for me if using NSBitmapImageRep's
representationUsingType:properties:
leaks really really bad?
My properties are pretty basic:
Code:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:snapShotResolution],
NSImageCompressionFactor,
NULL];
and I know as soon as I try to do this:
Code:
NSData *data = [rep representationUsingType:NSJPEGFileType
properties: properties];
I keep getting new memory allocated that is never reclaimed by the system. Removing that line happens to remove the memory leak as well, so I'm pretty sure something screwy is happening with that method...
Thanks,
Matt Fahrenbacher
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
Okay, so here's a picture of what OmniObjectMeter is telling me:
If you notice on the left, you'll see 2,359,296 bytes of memory allocated several times - in fact, it's the number of times I've called representationUsingType:properties:
Now when you examine one of those allocations on the right hand side, you'll notice that the leak goes back to another helper method called that I have nothing to do with. So... I am just screwed until Apple fixes the bug, or is there something else I can do?
Thanks,
Matt Fahrenbacher
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
Unless I'm really confused, there seems to be massive amounts of leaking and undocumented, inconsitent behavior in the Apple image APIs. For example:
+imageRepWithData: in NSBitmapImageRep returns an object that isn't scheduled to be autoreleased! I had to do it manually...
-TIFFRepresentationUsingCompression:factor: in NSImage makes a call to NSBitMapImageRep... which unfortunately allocates some memory which also isn't autoreleased! I'm playing with posers and categories right now to get rid of the leak myself, but this is stupid!
Matt Fahrenbacher
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
Okay, I've changed my mind - I think there's just a whole lot of caching going on. It is somewhat unnerving to see my memory usage go up so much and then drop dramatically though.
Matt Fahrenbacher
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
Yeah, it really is disconcerting. I think you're correct about the caching, though.
|
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|