Re: NSGraphicsContext graphicsContextWithBitmapImageRep - Memory leak
Re: NSGraphicsContext graphicsContextWithBitmapImageRep - Memory leak
- Subject: Re: NSGraphicsContext graphicsContextWithBitmapImageRep - Memory leak
- From: Ken Thomases <email@hidden>
- Date: Mon, 10 Feb 2014 10:10:08 -0600
On Feb 10, 2014, at 2:16 AM, Dany Golubitsky wrote:
> Hello Ken and thanks for your answer!
You're welcome.
> 1) SBitmapImageRep is actually NSBitmapImageRep. N is just get lost in Copy. Sorry.
Ah, I should have figured.
> 2) I tried both with release and without release of newContext. Same effect.
> 3) I am sorry for misguide a little. The drawing is not entirely with openGL. The simple story is that we need to draw text. We can not do it with openGL, so what we do is - we create another context with NSBitmapImageRep, we draw the text there, than we draw the texture with openGL.
I'm guessing that the problem is in the code you omitted. For example, how do you get the text from the bitmap context into the OpenGL drawing?
> At that point, we would like to release both textRep and newContext since we do not need them anymore.
> 4) I know that this is memory leak since application memory is constantly growing up to 2GB (Maybe even more). I run it with Leaks instrument. It does not recognize it as leak, only as allocation.
OK, but it should show you what code is responsible for the allocation. Also, if the allocation isn't an object, you may need to guess which object owns it and follow the retain/release history of that object, too.
> If I comment this part of code memory size reduces dramatically.
What if you only comment out the code which you omitted ("Some drawing with openGL")? So, create the bitmap image rep, create the graphics context, make it current, then restore the previous context and release the image rep. Don't do any drawing.
Regards,
Ken
_______________________________________________
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