Click here to Skip to main content
15,892,072 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Safe App Pin
john56325-Sep-11 3:53
john56325-Sep-11 3:53 
AnswerRe: Safe App Pin
Emilio Garavaglia5-Sep-11 20:39
Emilio Garavaglia5-Sep-11 20:39 
GeneralRe: Safe App Pin
jschell7-Sep-11 8:23
jschell7-Sep-11 8:23 
GeneralRe: Safe App Pin
Emilio Garavaglia7-Sep-11 20:43
Emilio Garavaglia7-Sep-11 20:43 
Questionspecifications of operator-overload Pin
Cold_Fearing_Bird5-Sep-11 2:07
Cold_Fearing_Bird5-Sep-11 2:07 
AnswerRe: specifications of operator-overload Pin
Code-o-mat5-Sep-11 2:38
Code-o-mat5-Sep-11 2:38 
AnswerRe: specifications of operator-overload Pin
Stefan_Lang5-Sep-11 2:47
Stefan_Lang5-Sep-11 2:47 
QuestionMemory Leak Problem Pin
Amrit Agr5-Sep-11 1:07
Amrit Agr5-Sep-11 1:07 
Hi Developers,

I was facing "Memory Leak" problem, from this chunk of code.
I have allocate a memory for a structure( pRecStruct ) & after that it has stored in a map( CMapWordToPtr - pMapUserBoard ) for furher use.

I have tried to delete as well, but the next time if i am trying to use.

Plese tell me the issue.


if( bSymAlreadyPresent == false )
{
CString str(pDBStruct->Symp);
strTemp.Format( _T("%d"), userClipIndx + 1 );

str += " Symptom Dropped on Clipboard " + strTemp;

MessageBox( NULL, str, "", MB_OK );

NEWDB_STRUCT near *pRecStruct=NULL;
pRecStruct=new NEWDB_STRUCT;
int cLen=strlen(pDBStruct->Symp);
pRecStruct->Symp=new char[cLen+1];
memset(pRecStruct->Symp, NULL,cLen+1);
memcpy(pRecStruct->Symp,pDBStruct->Symp,cLen);

pRecStruct->Remedy=new char[strlen(pDBStruct->Remedy)+1];
memset(pRecStruct->Remedy, NULL,strlen(pDBStruct->Remedy)+1);
memcpy(pRecStruct->Remedy,pDBStruct->Remedy,strlen(pDBStruct->Remedy));

pRecStruct->RecSize=pDBStruct->RecSize;
pRecStruct->LevelNum=pDBStruct->LevelNum;
pRecStruct->RemedyCnt=pDBStruct->RemedyCnt;

iTemp = pMapUsrClipboard->GetCount();

pRecStruct->SymNo = iTemp;
pRecStruct->Author=pDBStruct->Author;
pRecStruct->RecNo=pDBStruct->RecNo;
pRecStruct->ParOffset=pDBStruct->ParOffset;
pRecStruct->NextOffset=pDBStruct->NextOffset;
pRecStruct->CurOffset=pDBStruct->CurOffset;
pRecStruct->SymType=0;

pMapUsrClipboard->SetAt( iTemp, pRecStruct ); /// for remedies

/* delete pRecStruct;
pRecStruct = NULL;*/
bResult = true;
//clip1++;
}

Thanks.
Amrit Agrawal
Software Developer.
AnswerRe: Memory Leak Problem Pin
CPallini5-Sep-11 2:03
mveCPallini5-Sep-11 2:03 
AnswerRe: Memory Leak Problem Pin
Arun Parthasarathy7-Sep-11 2:27
Arun Parthasarathy7-Sep-11 2:27 
AnswerRe: Memory Leak Problem Pin
David Crow7-Sep-11 6:32
David Crow7-Sep-11 6:32 
GeneralRe: Memory Leak Problem Pin
Arun Parthasarathy8-Sep-11 23:06
Arun Parthasarathy8-Sep-11 23:06 
Questionload dll Pin
Benjamin Bruno4-Sep-11 21:01
Benjamin Bruno4-Sep-11 21:01 
QuestionRe: load dll Pin
CPallini4-Sep-11 21:34
mveCPallini4-Sep-11 21:34 
AnswerRe: load dll Pin
Orjan Westin4-Sep-11 23:44
professionalOrjan Westin4-Sep-11 23:44 
AnswerRe: load dll Pin
Eugen Podsypalnikov5-Sep-11 3:24
Eugen Podsypalnikov5-Sep-11 3:24 
Questionmfc100u.lib Pin
columbos149274-Sep-11 2:10
columbos149274-Sep-11 2:10 
AnswerRe: mfc100u.lib Pin
enhzflep4-Sep-11 4:02
enhzflep4-Sep-11 4:02 
QuestionAdd new sheet in Excel using mfc... Pin
spalanivel3-Sep-11 21:42
spalanivel3-Sep-11 21:42 
AnswerRe: Add new sheet in Excel using mfc... Pin
_Flaviu8-Sep-11 5:37
_Flaviu8-Sep-11 5:37 
QuestionShowNotifyBaloon problem [modified] Pin
_Flaviu3-Sep-11 3:41
_Flaviu3-Sep-11 3:41 
AnswerRe: ShowNotifyBaloon problem Pin
Richard Andrew x643-Sep-11 8:48
professionalRichard Andrew x643-Sep-11 8:48 
GeneralRe: ShowNotifyBaloon problem Pin
_Flaviu3-Sep-11 8:55
_Flaviu3-Sep-11 8:55 
GeneralRe: ShowNotifyBaloon problem Pin
Chuck O'Toole3-Sep-11 9:20
Chuck O'Toole3-Sep-11 9:20 
GeneralRe: ShowNotifyBaloon problem Pin
Richard Andrew x643-Sep-11 9:27
professionalRichard Andrew x643-Sep-11 9:27 

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.