Click here to Skip to main content
15,911,848 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
First, when you delete an object using a pointer then other pointers, including the copy you stored in the map, will not be changed - instead they will then point to invalid memory. Trying to use them causes undefined behaviour. In short: don't do that!

Second, don't store pointers, store the objects instead. That way you'll save one pointer entry per entry, and the map will destroy the objects once you remove the entry from the map.

Third, from other comments I've gathered that you cannot actually afford to keep the whole map in memory. If that is the problem, then my best advice is: do not try to program that! Instead, use a database. The only alternative would be to selectively remove rarely used entries from your map and reread them later, when needed. But that would be inefficient, if the file you are reading is not itself indexed in some way. not to mention that such a paging mechanism isn't exactly easy to implement. A database however has these mechanisms, and rereading individual records back into memory later is fast.
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 
QuestionRe: Need vital help about MFC - ADO.Net (SQL connection) Pin
David Crow3-Oct-11 10:59
David Crow3-Oct-11 10:59 
AnswerRe: Need vital help about MFC - ADO.Net (SQL connection) Pin
symeramon3-Oct-11 11:10
symeramon3-Oct-11 11:10 
JokeRe: Need vital help about MFC - ADO.Net (SQL connection) Pin
Albert Holguin3-Oct-11 15:46
professionalAlbert Holguin3-Oct-11 15:46 

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.