Re: Releasing question
Re: Releasing question
- Subject: Re: Releasing question
- From: "M. Uli Kusterer" <email@hidden>
- Date: Fri, 10 Oct 2003 15:26:03 +0200
At 11:45 Uhr +0200 09.10.2003, Damien Pacaud wrote:
hi,
I am not sure about this one...
I allocate an unsigned char * for the size of an image.
Then i pass the adress of this pointer to NSBitmapImageRep via
initWithBitmapDataPlanes:
then, I allocate an NSImage and add the previousely created
representation to it.
My question is : since NSBitmapImageRep does'nt copy the data contained
in the unsigned char * , is this memory zone freed when I release the
imageRep or when I release the Image ?
or is is just not freed ?
In my experience, you're responsible for freeing it. In some cases
you can copy it into an NSData object and pass [myData bytes] to
initWithBitmapDataPlanes. That way, you can at least use an
autorelease pool or some other ObjC way to dispose of the data, which
may be less hassle than keeping around a straight pointer and
free()ing that..
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.