Click here to Skip to main content
15,887,416 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Local Variable changes suddenly Pin
Nxsis20-Apr-10 19:44
Nxsis20-Apr-10 19:44 
GeneralRe: Local Variable changes suddenly Pin
Stephen Hewitt21-Apr-10 0:21
Stephen Hewitt21-Apr-10 0:21 
QuestionRe: Local Variable changes suddenly Pin
David Crow20-Apr-10 3:44
David Crow20-Apr-10 3:44 
AnswerRe: Local Variable changes suddenly Pin
Nxsis20-Apr-10 19:38
Nxsis20-Apr-10 19:38 
QuestionRe: Local Variable changes suddenly Pin
David Crow21-Apr-10 2:50
David Crow21-Apr-10 2:50 
AnswerRe: Local Variable changes suddenly Pin
LintMan20-Apr-10 6:18
LintMan20-Apr-10 6:18 
GeneralRe: Local Variable changes suddenly Pin
Nxsis20-Apr-10 19:37
Nxsis20-Apr-10 19:37 
GeneralRe: Local Variable changes suddenly Pin
LintMan21-Apr-10 4:01
LintMan21-Apr-10 4:01 
Ahh, the fact that it runs thousands of times OK before crashing changes things a bit. I don't suppose it's so convenient as to always crash at the exact same point/iteration?

If you really think the local variable is getting suddenly changed, and that's causing the problem, you should try to prove that or disprove it:

- Definitely try moving it to a global.

- Do the other local variables in the function all look OK when you look at the in the dump? Is myNumberOfElements the last variable declared in the function? It would be odd if only myNumberOfElements was getting corrupted and nothing else around it (unless AllocArray is taking a reference to it and corrupting it there). You could try placing "guard" variables or the same size, with known values, declared right before and after myNumberOfElements and seeing if those get alterred in any way during the crash.

- store the result of myCalculation in two or three separate variables (in different locations - a global, a heap var, and the stack) that you can compare in the dump. No way they can all get corrupted in the same way without everything else in the program also doing so.

- log the value to a file when received from myCalculation and again immediately before the AllocArray call.

One or more of thse things should be sufficient to prove or disprove your theory and give you enough tot go on for the next step
GeneralRe: Local Variable changes suddenly Pin
Nxsis22-Apr-10 2:37
Nxsis22-Apr-10 2:37 
GeneralRe: Local Variable changes suddenly Pin
LintMan23-Apr-10 6:50
LintMan23-Apr-10 6:50 
QuestionWindows 7 + Mailslot [solved] Pin
Member 138094720-Apr-10 2:46
Member 138094720-Apr-10 2:46 
AnswerRe: Windows 7 + Mailslot Pin
Michel Godfroid20-Apr-10 3:31
Michel Godfroid20-Apr-10 3:31 
GeneralRe: Windows 7 + Mailslot Pin
Member 138094720-Apr-10 3:47
Member 138094720-Apr-10 3:47 
GeneralRe: Windows 7 + Mailslot Pin
Michel Godfroid20-Apr-10 5:06
Michel Godfroid20-Apr-10 5:06 
GeneralRe: Windows 7 + Mailslot Pin
Member 138094720-Apr-10 23:32
Member 138094720-Apr-10 23:32 
GeneralRe: Windows 7 + Mailslot Pin
BW0228-Mar-11 11:47
BW0228-Mar-11 11:47 
GeneralRe: Windows 7 + Mailslot Pin
Member 138094713-Mar-11 2:49
Member 138094713-Mar-11 2:49 
GeneralRe: Windows 7 + Mailslot Pin
Member 138094713-Mar-11 2:59
Member 138094713-Mar-11 2:59 
QuestionRun Sample program in mingw with msys [modified] Pin
Game-point20-Apr-10 1:53
Game-point20-Apr-10 1:53 
AnswerRe: Run Sample program in mingw with msys Pin
CPallini20-Apr-10 2:37
mveCPallini20-Apr-10 2:37 
QuestionCatch 'Print' button click event of print dialog from MFC application Pin
Rahul B S20-Apr-10 1:26
Rahul B S20-Apr-10 1:26 
QuestionRe: Catch 'Print' button click event of print dialog from MFC application Pin
David Crow20-Apr-10 2:54
David Crow20-Apr-10 2:54 
AnswerRe: Catch 'Print' button click event of print dialog from MFC application Pin
Rahul B S20-Apr-10 3:51
Rahul B S20-Apr-10 3:51 
QuestionRe: Catch 'Print' button click event of print dialog from MFC application Pin
David Crow20-Apr-10 4:04
David Crow20-Apr-10 4:04 
AnswerRe: Catch 'Print' button click event of print dialog from MFC application Pin
Rahul B S20-Apr-10 4:15
Rahul B S20-Apr-10 4:15 

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.