Re: "Live" image preview, huge memory usage...

2008-12-04 Thread Jean-Nicolas Jolivet
Thanks for the links! They were pretty much all interesting reading!! However, I still have a problem... Rob Keniger's code for preventing leaks when drawing CIImage off-screen works well, however if I generate my images in an NSOperation, the leaks re-appear... and since Im generating a bu

Re: "Live" image preview, huge memory usage...

2008-12-04 Thread Erik Buck
See http://theocacao.com/document.page/497 See http://www.wilshipley.com/blog/2005/09/jpeg2000-cool-but-slow.html See http://www.macresearch.org/cocoa-tutorial-image-kit-and-image-browser-views-part-i See http://www.macresearch.org/cocoa-tutorial-image-kit-cover-flow-and-quicklook-doing-things-we

Re: "Live" image preview, huge memory usage...

2008-12-04 Thread Jean-Nicolas Jolivet
One last thing (I know, I'm annoying!..) I'm guessing its impossible to have this sweet workaround working in a thread right? Thing is, I have a lot of images to generate.. so I do it in a separate thread... your trick works well (borrowing an onscreen graphic context), but as soon as I do

Re: "Live" image preview, huge memory usage...

2008-12-04 Thread Jean-Nicolas Jolivet
Just wanted to say that I got it to work finally! :) basically I thought the last part of your code, where you render the CGImage in the current context was a necessary part of the trick, I realized that it wasn't hehe... No noticeable leaks now! Thanks a lot for this trick! On 3-Dec-08,

Re: "Live" image preview, huge memory usage...

2008-12-03 Thread Jean-Nicolas Jolivet
Mmm I guess I was doing something wrong then! When I tried the code you posted, my image covered my main window... which, I assumed was not the expected behavior hehe (I did modify it a bit though... the thing is, I need to get a BitmapImageRep out of it and I'm not so sure how to do it

Re: "Live" image preview, huge memory usage...

2008-12-03 Thread Rob Keniger
On 03/12/2008, at 6:22 PM, Jean-Nicolas Jolivet wrote: Quick question (2 actually), right now Im drawing my CIImage in a custom view... would drawing the CIImage in my view's drawRect method achieve the same (leak-free) result as your piece of code??? i.e. something simple like: As far

Re: "Live" image preview, huge memory usage...

2008-12-03 Thread Jean-Nicolas Jolivet
Thanks a lot for this code Rob! Quick question (2 actually), right now Im drawing my CIImage in a custom view... would drawing the CIImage in my view's drawRect method achieve the same (leak-free) result as your piece of code??? i.e. something simple like: // previewImage is an NSBitmapIm

Re: "Live" image preview, huge memory usage...

2008-12-03 Thread Rob Keniger
On 03/12/2008, at 5:34 PM, Jean-Nicolas Jolivet wrote: Hmm I just found an older post that mentions a big memory leak problem when drawing CIImage offscreen I guess I'll have to do this differently... Ah, you've just reminded me. There is a major leak in drawing CIImage offscreen bu

Re: "Live" image preview, huge memory usage...

2008-12-02 Thread Jean-Nicolas Jolivet
Hmm I just found an older post that mentions a big memory leak problem when drawing CIImage offscreen I guess I'll have to do this differently... On 3-Dec-08, at 2:20 AM, Jean-Nicolas Jolivet wrote: hmmm while playing with Instruments and Activity Monitor I realized two things...first

Re: "Live" image preview, huge memory usage...

2008-12-02 Thread Jean-Nicolas Jolivet
hmmm while playing with Instruments and Activity Monitor I realized two things...first, Activity Monitor (as I knew already) is not really a good indication for finding leaks... Also, It seems like the memory usage is climbing only when I make usage of CIImage... if I only re-size/crop the

Re: "Live" image preview, huge memory usage...

2008-12-02 Thread Jean-Nicolas Jolivet
mmm thanks for the info, I'm trying right now to draw directly in a custom view... unfortunately I still get the same result... on average each time I regenerate the preview the memory usage in Activity monitor goes up by approx. 10mb (real memory), and never comes down... at this rate it c

Re: "Live" image preview, huge memory usage...

2008-12-02 Thread Rob Keniger
On 03/12/2008, at 1:53 PM, Jean-Nicolas Jolivet wrote: since I already have a bitmapImageRep I figured displaying its data in an NSImaveView was probably not a big loss in terms of performance... I wonder if drawing directly would be worth it in my case... and most importantly, if it would

Re: "Live" image preview, huge memory usage...

2008-12-02 Thread Jean-Nicolas Jolivet
Interesting... I thought about it but dismissed the idea (can't really remember why)... The thing is, though, that I am also doing some fancier stuff with the pic ( i.e re-sizing and/or cropping, adding a border etc..).. I wrote all these methods already without CIImage (basically Im using

Re: "Live" image preview, huge memory usage...

2008-12-02 Thread douglas welton
Jean-Nicolas, I haven't followed all of your previous post, so I may be proposing something that you have dismissed already... Is there a reason that you are using NSImageView to display the image instead of drawing directly (in a custom view) from the CIImage that is output from the last

Re: "Live" image preview, huge memory usage...

2008-12-02 Thread Jean-Nicolas Jolivet
Well, right now I am using CoreImage (CIImage and CIImageFilters) to do the brightness/contrast adjustment... The problem is, I still have to put the result in my NSImageView after that (which is, I assume, what takes up all this ram??) On 2-Dec-08, at 6:38 PM, glenn andreas wrote: On D

Re: "Live" image preview, huge memory usage...

2008-12-02 Thread glenn andreas
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) t

"Live" image preview, huge memory usage...

2008-12-02 Thread Jean-Nicolas Jolivet
(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