Re: "Live" image preview, huge memory usage...
Re: "Live" image preview, huge memory usage...
- Subject: Re: "Live" image preview, huge memory usage...
- From: glenn andreas <email@hidden>
- Date: Tue, 02 Dec 2008 17:38:05 -0600
On Dec 2, 2008, at 5:29 PM, Jean-Nicolas Jolivet wrote:
(This is linked to my last post on the list, however it's a
completely different topic so I posted it separately)
To sum it up, my app allows to do some basic modifications to an
image (brightness/contrast/saturation among others).... those are
applied via CIFilters, the app also allows to re-size images...Right
now I'm trying to work exclusively with BitmapImageRep since it
seems to be faster than using NSImage...
I display a "live" preview of the image (I say "live" because
basically all my sliders (to control brightness etc.) do not send
continuously but only once the mouse released them)... anyway the
way I got it working right now is like this:
I have an NSBitmapImageRep called "previewImage"... this contains
the preview image and it gets updated everytime the brightness/
contrast/saturation sliders are released...
in my preview window, I have an NSImageView.. I bound the data of
this image view to the "previewImageData" key of my controller which
basically only does this:
return [previewImage TIFFRepresentation];
Now, all this is working well, however, I see HUGE ram increases
every time I move a slider.. (it gets in the 100+ mb very
fast)...and it never seems to drop... I tried to set my sliders to
continuous for fun, it gets at about 200mb of ram in a matter of
seconds...
I ran Instruments and MallocDebug, apparently I have no leaks (the
only leaks I have are NSPathStore which I am not creating)...
Is anything wrong with the way Im doing it? Why the huge ram
increases that never drops? If there was an obvious leak I guess
Instrument or MallocDebug would've catch it?
One thing to look at is to use CoreImage to do the brightness/contrast
adjustments - rest assured, it will be able to adjust the brightness
and contrast of an image faster than you will (since it can use the
video card, for example).
Another option, though trickier, is to use ColorSync and make an
adjustment profile which is attached to the image, and then just have
the image refreshed with the new profile - for things like contrast,
brightness, gamma, etc... this works well all the way back to 10.3.
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
JSXObjC | the easy way to unite JavaScript and Objective C
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden