Click here to Skip to main content
16,018,797 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: More problem Pin
Hamid Taebi1-Mar-07 17:56
professionalHamid Taebi1-Mar-07 17:56 
AnswerRe: More problem Pin
John R. Shaw2-Mar-07 21:39
John R. Shaw2-Mar-07 21:39 
Questioncomplete Pin
Kiethnt1-Mar-07 17:25
Kiethnt1-Mar-07 17:25 
AnswerRe: complete Pin
Cedric Moonen1-Mar-07 20:05
Cedric Moonen1-Mar-07 20:05 
QuestionC++ to DSP Pin
apoc831-Mar-07 14:28
apoc831-Mar-07 14:28 
AnswerRe: C++ to DSP Pin
Cedric Moonen1-Mar-07 20:07
Cedric Moonen1-Mar-07 20:07 
GeneralRe: C++ to DSP Pin
apoc831-Mar-07 20:26
apoc831-Mar-07 20:26 
QuestionProblem using CStrings in a linked list (memory leak) Pin
CoffeeAddict191-Mar-07 10:25
CoffeeAddict191-Mar-07 10:25 
I'm using a singly linked list of structures. Each structure has 3 cstrings and a pointer in it. The reason I'm using cstrings and not strings is that I'm populating a list box that has to stay persistent. I could use strings but I would have to use .c_str() every time. I wrote the code for the linked list with help from wikepedia and a book and it works, the problem is that I have a memory leak. I still can't find any error in the code though.

My question is, are there any special issues with cstrings that would cause a memory leak in this situation? Are their any known problems with their destructors?

Here is the function that destroys the linked list if you wouldn't mind checking it:
CStringLListElement* CurrentPtr = HeadPtr;
CStringLListElement* BackPtr = HeadPtr;

while(CurrentPtr != NULL)
{
	BackPtr = CurrentPtr;
	CurrentPtr = CurrentPtr->ForwardPtr;
	delete BackPtr;
}


Here is part of the error message from the compiler (I only listed a few lines):

Detected memory leaks!
Dumping objects ->
{299} normal block at 0x010A65A8, 152 bytes long.
Data: <h w="" 200310=""> 48 EC 57 00 CD CD CD CD 32 30 30 33 31 30 00 CD
{298} normal block at 0x010A64D0, 152 bytes long.
Data: << W 200310 > 3C EC 57 00 CD CD CD CD 32 30 30 33 31 30 00 CD
{297} normal block at 0x010A63F8, 152 bytes long.
Data: < W 200310 > E4 EB 57 00 CD CD CD CD 32 30 30 33 31 30 00 CD
{296} normal block at 0x010A6320, 152 bytes long.
Data: < W 200310 > F8 EB 57 00 CD CD CD CD 32 30 30 33 31 30 00 CD
{295} normal block at 0x010A6248, 152 bytes long.The program '[2212] CS_Project.exe: Native' has exited with code 0 (0x0).

Thanks for looking at this. I would appreciate any help. Smile | :)
AnswerRe: Problem using CStrings in a linked list (memory leak) Pin
Mark Salsbery1-Mar-07 10:57
Mark Salsbery1-Mar-07 10:57 
AnswerRe: Problem using CStrings in a linked list (memory leak) Pin
led mike1-Mar-07 11:30
led mike1-Mar-07 11:30 
GeneralRe: Problem using CStrings in a linked list (memory leak) Pin
Nibu babu thomas1-Mar-07 16:20
Nibu babu thomas1-Mar-07 16:20 
AnswerRe: Problem using CStrings in a linked list (memory leak) Pin
prasad_som1-Mar-07 20:00
prasad_som1-Mar-07 20:00 
Questiongenerating reports Pin
namratab1-Mar-07 8:51
namratab1-Mar-07 8:51 
AnswerRe: generating reports Pin
Anders Gustafsson1-Mar-07 9:18
Anders Gustafsson1-Mar-07 9:18 
GeneralRe: generating reports Pin
namratab1-Mar-07 9:34
namratab1-Mar-07 9:34 
GeneralRe: generating reports Pin
Anders Gustafsson1-Mar-07 22:17
Anders Gustafsson1-Mar-07 22:17 
QuestionSocket curious error Pin
Alex Cutovoi1-Mar-07 7:42
Alex Cutovoi1-Mar-07 7:42 
AnswerRe: Socket curious error Pin
Mark Salsbery1-Mar-07 8:40
Mark Salsbery1-Mar-07 8:40 
GeneralRe: Socket curious error Pin
Alex Cutovoi1-Mar-07 10:38
Alex Cutovoi1-Mar-07 10:38 
GeneralRe: Socket curious error Pin
Mark Salsbery1-Mar-07 10:44
Mark Salsbery1-Mar-07 10:44 
GeneralRe: Socket curious error Pin
Alex Cutovoi1-Mar-07 11:12
Alex Cutovoi1-Mar-07 11:12 
GeneralRe: Socket curious error [modified] Pin
Mark Salsbery1-Mar-07 11:23
Mark Salsbery1-Mar-07 11:23 
GeneralRe: Socket curious error Pin
led mike1-Mar-07 11:31
led mike1-Mar-07 11:31 
GeneralRe: Socket curious error Pin
Mark Salsbery1-Mar-07 11:36
Mark Salsbery1-Mar-07 11:36 
QuestionHow do you TRACE() a BSTR?? Pin
Anders Gustafsson1-Mar-07 7:30
Anders Gustafsson1-Mar-07 7:30 

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.