Click here to Skip to main content
15,919,500 members
Home / Discussions / Mobile
   

Mobile

 
GeneralRe: sharing code between a WinCE and windows application Pin
Anonymous11-Apr-03 19:11
Anonymous11-Apr-03 19:11 
GeneralMultiple property sheet with a global toolbar Pin
mengi7-Apr-03 0:01
mengi7-Apr-03 0:01 
Question How to show the SIP automaticly at startup? Pin
Daniel Strigl5-Apr-03 4:32
Daniel Strigl5-Apr-03 4:32 
AnswerRe: How to show the SIP automaticly at startup? Pin
João Paulo Figueira5-Apr-03 6:10
professionalJoão Paulo Figueira5-Apr-03 6:10 
GeneralRe: How to show the SIP automaticly at startup? Pin
Daniel Strigl5-Apr-03 23:00
Daniel Strigl5-Apr-03 23:00 
GeneralDatatype Misalignment Pin
PaulJ3-Apr-03 10:33
PaulJ3-Apr-03 10:33 
GeneralRe: Datatype Misalignment Pin
Jonas Larsson4-Apr-03 2:17
Jonas Larsson4-Apr-03 2:17 
GeneralUnable to free memory in the destructor of a class exported in a dll. Pls Help Pin
Anand Vinod3-Apr-03 4:12
Anand Vinod3-Apr-03 4:12 
Hi
Here's what i'm trying;

I have a DLL from which I have exported a set of classes. I have 2 generic classes; say CCat and CCats (Simple Classes).

In CCats class i have a pointer to an object of the CCat class (CCat *m_pCatsCollection). CCats is supposed to maintain a collection of classes. So in the "Initialize" member function of CCats class i dynamically allocate memory in this fashion;

m_pCatsCollection = new CCat[10] // to store 10 cats.

Now, in the destructor of the CCats class i'm freeing the memory in this fashion;

if(m_pCatsCollection) {

delete []m_pCatsCollection; m_pCatsCollection = NULL;

}

I'm using this DLL to populate contols in a MFC exe!

If I put this in the destructor its crashing, and it unpredictable, i.e. sometimes it crashes sometimes it hangs, sometimes it works fine. I even tried freeing individual CCat object memory in a for loop it does not work. I even had a Release member function to do this, but that also doesnt work.

Am i doing something wrong, i dont know why this is happenning. Is there any problem in allocating and freeing memory in a Class exported in a DLL.

If I comment out the above code of delete then everything works fine, but i know i'm not freeing memory.

I also tried using the STL "list" template class to do this, using list::push_back to insert objects and list::clear to delete all objects but still its not working, i'm just not able to free memory in the destructor of the CCats Class.

Pls Help!
Anand


Anand Vinod
GeneralRe: Unable to free memory in the destructor of a class exported in a dll. Pls Help Pin
João Paulo Figueira3-Apr-03 5:02
professionalJoão Paulo Figueira3-Apr-03 5:02 
GeneralRe: Unable to free memory in the destructor of a class exported in a dll. Pls Help Pin
Anand Vinod3-Apr-03 23:59
Anand Vinod3-Apr-03 23:59 
GeneralRe: Unable to free memory in the destructor of a class exported in a dll. Pls Help Pin
João Paulo Figueira4-Apr-03 1:36
professionalJoão Paulo Figueira4-Apr-03 1:36 
GeneralRe: Unable to free memory in the destructor of a class exported in a dll. Pls Help Pin
João Paulo Figueira4-Apr-03 1:45
professionalJoão Paulo Figueira4-Apr-03 1:45 
GeneralDate Time Picket in a PropertyPage... Pin
Joshua Guy3-Apr-03 3:34
Joshua Guy3-Apr-03 3:34 
GeneralRe: Date Time Picket in a PropertyPage... Pin
João Paulo Figueira3-Apr-03 3:47
professionalJoão Paulo Figueira3-Apr-03 3:47 
GeneralRe: Date Time Picket in a PropertyPage... Pin
Joshua Guy3-Apr-03 4:53
Joshua Guy3-Apr-03 4:53 
GeneralList Control with Check box option Pin
Kyle P1-Apr-03 15:25
Kyle P1-Apr-03 15:25 
GeneralCompareItem Pin
Anthony988731-Mar-03 3:25
Anthony988731-Mar-03 3:25 
GeneralCreating a simple CSV file Pin
PaulJ27-Mar-03 11:10
PaulJ27-Mar-03 11:10 
GeneralRe: Creating a simple CSV file Pin
João Paulo Figueira27-Mar-03 12:07
professionalJoão Paulo Figueira27-Mar-03 12:07 
GeneralRe: Creating a simple CSV file Pin
UKTrebor10-Apr-03 4:52
UKTrebor10-Apr-03 4:52 
GeneralDisplay objects of the same type Pin
Mariz27-Mar-03 8:15
Mariz27-Mar-03 8:15 
GeneralRe: Display objects of the same type Pin
João Paulo Figueira27-Mar-03 12:02
professionalJoão Paulo Figueira27-Mar-03 12:02 
GeneralCWindow over CView Pin
Mariz27-Mar-03 7:59
Mariz27-Mar-03 7:59 
GeneralGetSystemPowerStatusEx() Pin
Joshua Guy27-Mar-03 6:18
Joshua Guy27-Mar-03 6:18 
GeneralRe: GetSystemPowerStatusEx() Pin
MiteK19818-May-09 0:31
MiteK19818-May-09 0:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.