The released object is not releasing memory
The released object is not releasing memory
- Subject: The released object is not releasing memory
- From: Vinay Prabhu <email@hidden>
- Date: Mon, 14 May 2007 15:16:19 +0530
- Importance: Normal
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:
This email sent to email@hidden