• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
The released object is not releasing memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: The released object is not releasing memory
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: entity referencing self in relationship attribute
  • Next by Date: Re: Re: drag and drop problem.
  • Previous by thread: Re: entity referencing self in relationship
  • Next by thread: Re: The released object is not releasing memory
  • Index(es):
    • Date
    • Thread