Re: I'm leaking memory
Re: I'm leaking memory
- Subject: Re: I'm leaking memory
- From: glenn andreas <email@hidden>
- Date: Fri, 11 Feb 2005 14:57:23 -0600
On Feb 11, 2005, at 2:32 PM, Brian O'Brien wrote:
I think I finally found the 'problem'(s)
As well as not having set the pool up....
in my class i have:
@interface dicomSCP : NSObject {
std::string myAET;
std::list<std::string> acceptAETs;
int portno;
}
In my methods any time I try to set these member variables an exception is raised...
I'm sorry I'm new to Cocoa and ObjectiveC but it seems to me that somehow these member variables
are not initialized....
In ObjectiveC _all_ instance variable memory is zeroed when the object is created. C++ expects to be able to have objects have their constructor run when the object is created. ObjectiveC++ allows both but keeps them completely independant - the ObjectiveC half know nothing about C++ objects and how ctors need to be run (and C++ doesn't automatically set it's contents to zero). This alone will cause some serious problems.
You'll need to either use placement new in your init method, or switch to using pointers to C++ objects and allocate them with new std::string/new std::list<std::string> in your init method.
Glenn Andreas email@hidden
<http://www.gandreas.com/> oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
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