• 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
Re: Objective C++ memory management
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective C++ memory management


  • Subject: Re: Objective C++ memory management
  • From: Garvin Haslett <email@hidden>
  • Date: Tue, 1 Nov 2005 18:00:53 +0000

You are correct, which leaves me mystified. I thought that Cmd-Q or clicking the red button on the window would automatically force a call to dealloc. Clearly this is not the case. Can anyone clear up my confusion.

On 31 Oct 2005, at 21:43, Joseph Kelly wrote:

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:

This email sent to email@hidden





___________________________________________________________ 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:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Objective C++ memory management
      • From: Scott Ribe <email@hidden>
    • Re: Objective C++ memory management
      • From: Scott Ribe <email@hidden>
    • Re: Objective C++ memory management
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Implementing a queue between an application and a thread. Deeply confused...
  • Next by Date: Re: _NSKeyValueObservationInfoCreateByRemoving crashing
  • Previous by thread: Re: Implementing a queue between an application and a thread. Deeply confused...
  • Next by thread: Re: Objective C++ memory management
  • Index(es):
    • Date
    • Thread