Click here to Skip to main content
16,017,488 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Heap corruption. Pin
Gary R. Wheeler3-Jun-07 1:44
Gary R. Wheeler3-Jun-07 1:44 
GeneralRe: Heap corruption. Pin
Polite Programmer3-Jun-07 1:47
Polite Programmer3-Jun-07 1:47 
GeneralRe: Heap corruption. Pin
Polite Programmer3-Jun-07 1:57
Polite Programmer3-Jun-07 1:57 
GeneralRe: Heap corruption. Pin
Gary R. Wheeler3-Jun-07 1:59
Gary R. Wheeler3-Jun-07 1:59 
GeneralRe: Heap corruption. Pin
CPallini3-Jun-07 3:47
mveCPallini3-Jun-07 3:47 
AnswerRe: Heap corruption. Pin
Matthew Faithfull3-Jun-07 3:08
Matthew Faithfull3-Jun-07 3:08 
AnswerRe: Heap corruption. Pin
CPallini3-Jun-07 3:48
mveCPallini3-Jun-07 3:48 
AnswerRe: Heap corruption. Pin
Stephen Hewitt3-Jun-07 14:08
Stephen Hewitt3-Jun-07 14:08 
I give the following advice about once a month (more recently); it often helps me track down the nastier heap errors:

Try enabling the page heap[^] for your process. Follow these steps:
1. Download and install WinDBG[^].
2. Select “Start”->“All Programs”->“Debugging Tools for Windows”->“Global Flags”.
3. Select the “Image File” tab.
4. In the “Image: (TAB to refresh)” edit control enter the name of your app then press TAB. Just the name with the extension; not the full path.
5. Tick the following:
- “Enable page heap”
- “Enable heap tail checking”
- “Enable heap free checking”
- “Enable heap parameter checking”
- “Enable heap validation on call”
- “Create user mode stack trace database”
6. Press “Apply”.
7. Debug your application. Any debugger will do but with WinDBG you have access to the stack traces of allocations via the !heap –p –a command, for example. When a heap problem is detected a breakpoint will be generated.
8. When done un-tick all the options you ticked, press “Apply” then dismiss GFlags. This step is important as if it’s skipped all applications named as entered in step 4 will run with the page heap enabled.

Note that when using the page heap your application will run much slower than normal and consume way more memory. It’s good to have a beefy machine to do such tests; and such tests should be ran regularly on all applications you develop as part of regular testing activities. If I find a part of my application that’s too slow with the page heap enabled I optimize the memory allocation in that region.

Steve

GeneralRe: Heap corruption. Pin
Polite Programmer3-Jun-07 20:00
Polite Programmer3-Jun-07 20:00 
GeneralRe: Heap corruption. Pin
Polite Programmer3-Jun-07 20:01
Polite Programmer3-Jun-07 20:01 
GeneralRe: Heap corruption. Pin
Stephen Hewitt3-Jun-07 20:05
Stephen Hewitt3-Jun-07 20:05 
Questionhelp with fstream Pin
anbluemoon3-Jun-07 1:24
anbluemoon3-Jun-07 1:24 
AnswerRe: help with fstream Pin
CPallini3-Jun-07 4:02
mveCPallini3-Jun-07 4:02 
QuestionDLL and EXE files Pin
prithaa3-Jun-07 0:43
prithaa3-Jun-07 0:43 
AnswerRe: DLL and EXE files Pin
Christian Graus3-Jun-07 1:14
protectorChristian Graus3-Jun-07 1:14 
GeneralRe: DLL and EXE files Pin
Rajesh R Subramanian3-Jun-07 20:43
professionalRajesh R Subramanian3-Jun-07 20:43 
QuestionRe: DLL and EXE files Pin
Matthew Faithfull3-Jun-07 1:18
Matthew Faithfull3-Jun-07 1:18 
AnswerRe: DLL and EXE files Pin
prithaa3-Jun-07 1:42
prithaa3-Jun-07 1:42 
GeneralRe: DLL and EXE files Pin
Matthew Faithfull3-Jun-07 2:59
Matthew Faithfull3-Jun-07 2:59 
AnswerRe: DLL and EXE files Pin
Hamid_RT3-Jun-07 7:33
Hamid_RT3-Jun-07 7:33 
QuestionHow do I make a child dialog draw on a different HDC Pin
KellyR2-Jun-07 17:51
KellyR2-Jun-07 17:51 
AnswerRe: How do I make a child dialog draw on a different HDC Pin
Naveen3-Jun-07 16:17
Naveen3-Jun-07 16:17 
Questionagain for InterlockedIncrement() Pin
includeh102-Jun-07 16:52
includeh102-Jun-07 16:52 
AnswerRe: again for InterlockedIncrement() Pin
Matthew Faithfull3-Jun-07 1:07
Matthew Faithfull3-Jun-07 1:07 
GeneralRe: again for InterlockedIncrement() Pin
Mark Salsbery4-Jun-07 5:40
Mark Salsbery4-Jun-07 5:40 

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.