Click here to Skip to main content
15,916,422 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to clear Object memory of Map Pin
Richard MacCutchan3-Oct-11 21:26
mveRichard MacCutchan3-Oct-11 21:26 
GeneralRe: How to clear Object memory of Map Pin
002comp3-Oct-11 22:05
002comp3-Oct-11 22:05 
GeneralRe: How to clear Object memory of Map Pin
Richard MacCutchan3-Oct-11 22:24
mveRichard MacCutchan3-Oct-11 22:24 
GeneralRe: How to clear Object memory of Map Pin
002comp3-Oct-11 22:39
002comp3-Oct-11 22:39 
GeneralRe: How to clear Object memory of Map Pin
Richard MacCutchan4-Oct-11 1:11
mveRichard MacCutchan4-Oct-11 1:11 
GeneralRe: How to clear Object memory of Map Pin
002comp4-Oct-11 2:22
002comp4-Oct-11 2:22 
GeneralRe: How to clear Object memory of Map Pin
Richard MacCutchan4-Oct-11 2:25
mveRichard MacCutchan4-Oct-11 2:25 
AnswerRe: How to clear Object memory of Map Pin
ThatsAlok3-Oct-11 23:53
ThatsAlok3-Oct-11 23:53 
yogeshs wrote:
Test* obj = new Test();
for(.......)
{
...
...
reading File int obj pointer
And then inserting into map
mapTest.insert(make_pair(string,objTest));
}
 


because map keep reference to memory allocated to the object, since you deleting the obj afterward the actual memory got deleted and reference in map just point to deleted memory!.

if memory is not constraint you can create copy of memory variable when inserting into map!,however at the time of clearing of map you have to manually delete memory associated with the variables.

"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixture


cheers,
Alok Gupta
VC Forum Q&A :- I/IV
Support CRY- Child Relief and You

GeneralRe: How to clear Object memory of Map [ how to delete newed object tht we store in map] Pin
002comp4-Oct-11 0:10
002comp4-Oct-11 0:10 
AnswerRe: How to clear Object memory of Map [ how to delete newed object tht we store in map] Pin
ThatsAlok4-Oct-11 21:07
ThatsAlok4-Oct-11 21:07 
AnswerRe: How to clear Object memory of Map Pin
Stefan_Lang4-Oct-11 5:56
Stefan_Lang4-Oct-11 5:56 
SuggestionRe: How to clear Object memory of Map Pin
ThatsAlok4-Oct-11 20:55
ThatsAlok4-Oct-11 20:55 
GeneralRe: How to clear Object memory of Map Pin
Stefan_Lang4-Oct-11 21:50
Stefan_Lang4-Oct-11 21:50 
QuestionApplication getting carshed in release mode not in debug, in the follwing scenario Pin
Amrit Agr3-Oct-11 19:49
Amrit Agr3-Oct-11 19:49 
AnswerRe: Application getting carshed in release mode not in debug, in the follwing scenario Pin
Madhu Nair3-Oct-11 20:23
Madhu Nair3-Oct-11 20:23 
GeneralRe: Application getting carshed in release mode not in debug, in the follwing scenario Pin
Amrit Agr3-Oct-11 21:16
Amrit Agr3-Oct-11 21:16 
AnswerRe: Application getting carshed in release mode not in debug, in the follwing scenario Pin
Roger Allen4-Oct-11 2:06
Roger Allen4-Oct-11 2:06 
GeneralRe: Application getting carshed in release mode not in debug, in the follwing scenario Pin
David Crow4-Oct-11 4:59
David Crow4-Oct-11 4:59 
QuestionNeed vital help about MFC - ADO.Net (SQL connection) Pin
symeramon3-Oct-11 10:00
symeramon3-Oct-11 10:00 
AnswerMessage Removed Pin
3-Oct-11 10:16
TheGreatAndPowerfulOz3-Oct-11 10:16 
GeneralRe: Need vital help about MFC - ADO.Net (SQL connection) Pin
symeramon3-Oct-11 11:03
symeramon3-Oct-11 11:03 
GeneralMessage Removed Pin
3-Oct-11 11:19
TheGreatAndPowerfulOz3-Oct-11 11:19 
GeneralRe: Need vital help about MFC - ADO.Net (SQL connection) Pin
Richard Andrew x643-Oct-11 11:28
professionalRichard Andrew x643-Oct-11 11:28 
GeneralRe: Need vital help about MFC - ADO.Net (SQL connection) Pin
symeramon3-Oct-11 20:36
symeramon3-Oct-11 20:36 
GeneralRe: Need vital help about MFC - ADO.Net (SQL connection) Pin
David Crow4-Oct-11 4:51
David Crow4-Oct-11 4:51 

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.