Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective C++ memory management



I don't think C++ memory management has anything to do with this -- could it be that your QuartzView object's -dealloc: is never getting called, so the C++ object doesn't free? You might have to close your window explicitly.

joe





On Oct 31, 2005, at 10:54 AM, Garvin Haslett wrote:

I have a pointer to a C++ object within my ObjC class:

@interface QuartzView : NSView {
  BitMapMgr * pbmp;
}

@end

I have done the following to manage the object:

- (id)initWithFrame:(NSRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
      pbmp = new BitMapMgr;            // Call the constructor
    }
    return self;
}

- (void)dealloc {
  delete pbmp;                        // Call the destructor
}

However, when I run the application within Xcode print statements confirm that only the constructor gets called. What is the correct way to release the memory allocated for pbmp?

Thanks,

Garvin.



___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Objective C++ memory management (From: Garvin Haslett <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.