Re: The released object is not releasing memory
Re: The released object is not releasing memory
- Subject: Re: The released object is not releasing memory
- From: Mike Abdullah <email@hidden>
- Date: Mon, 14 May 2007 13:14:15 +0100
I would strongly advise you use a proper tool for measuring your
memory management; not Activity Monitor. I suggest looking at
ObjectAlloc for a start.
Bear in mind there is no guarantee that Cocoa will release the memory
straight away; the system may well perform some caching for you.
Mike.
On 14 May 2007, at 10:46, Vinay Prabhu wrote:
Hi,
I am trying draw into the bitmap rep directly.
Here is the code. At the end, I am releasing the NSBitmapImageRep.
When I debug this peace of code, I was monitoring the memory usage in
Activity Monitor.
When I create the object, the memory usage increases, but when I
release the
object, the memory occupied has not reduced.
So is there anything extra needs to be taken care here?
NSBitmapImageRep * bmp = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:nil
pixelsWide:m_uiWidth
pixelsHigh:m_uiHeight
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bytesPerRow:(4*m_uiWidth)
bitsPerPixel:32];
NSRect fillRect = NSMakeRect(0, 0, m_uiWidth, m_uiHeight);
NSGraphicsContext* currentContext = [NSGraphicsContext
currentContext];
NSGraphicsContext* bitmapContext = [NSGraphicsContext
graphicsContextWithBitmapImageRep:bmp];
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:bitmapContext];
//Drawing code here
[[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0] set];
NSRectFillUsingOperation(fillRect, NSCompositeSourceOver);
[NSGraphicsContext setCurrentContext:currentContext];
[NSGraphicsContext restoreGraphicsState];
[bmp release];
Regards
Vinay
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40mikeabdullah.net
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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