Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Heap error Pin
Matthew Faithfull5-Jun-07 8:55
Matthew Faithfull5-Jun-07 8:55 
GeneralRe: Heap error Pin
simoncoul5-Jun-07 9:53
simoncoul5-Jun-07 9:53 
GeneralRe: Heap error Pin
simoncoul5-Jun-07 9:58
simoncoul5-Jun-07 9:58 
GeneralRe: Heap error Pin
Matthew Faithfull5-Jun-07 10:28
Matthew Faithfull5-Jun-07 10:28 
GeneralRe: Heap error Pin
Michael Sadlon5-Jun-07 12:01
Michael Sadlon5-Jun-07 12:01 
GeneralRe: Heap error Pin
simoncoul6-Jun-07 3:56
simoncoul6-Jun-07 3:56 
GeneralRe: Heap error Pin
simoncoul6-Jun-07 4:03
simoncoul6-Jun-07 4:03 
AnswerRe: Heap error Pin
Stephen Hewitt5-Jun-07 14:33
Stephen Hewitt5-Jun-07 14:33 
I give the following advice about once a month (recently every few days); 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 error Pin
simoncoul6-Jun-07 8:41
simoncoul6-Jun-07 8:41 
QuestionUsing STL iterator as class member variable [modified] Pin
Anton1125-Jun-07 5:27
Anton1125-Jun-07 5:27 
AnswerRe: Using STL iterator as class member variable Pin
David Crow5-Jun-07 5:33
David Crow5-Jun-07 5:33 
GeneralRe: Using STL iterator as class member variable Pin
Anton1125-Jun-07 5:52
Anton1125-Jun-07 5:52 
AnswerRe: Using STL iterator as class member variable Pin
Arman S.5-Jun-07 5:55
Arman S.5-Jun-07 5:55 
GeneralRe: Using STL iterator as class member variable Pin
Anton1125-Jun-07 6:05
Anton1125-Jun-07 6:05 
QuestionTCPIP Socket error Pin
NorGUI5-Jun-07 4:59
NorGUI5-Jun-07 4:59 
QuestionRe: TCPIP Socket error Pin
David Crow5-Jun-07 5:27
David Crow5-Jun-07 5:27 
AnswerRe: TCPIP Socket error Pin
Mark Salsbery5-Jun-07 7:04
Mark Salsbery5-Jun-07 7:04 
QuestionDll used by app Pin
garfield1855-Jun-07 4:52
garfield1855-Jun-07 4:52 
AnswerRe: Dll used by app Pin
David Crow5-Jun-07 5:39
David Crow5-Jun-07 5:39 
GeneralRe: Dll used by app Pin
garfield1855-Jun-07 6:20
garfield1855-Jun-07 6:20 
QuestionCasts Pin
tom groezer5-Jun-07 2:18
tom groezer5-Jun-07 2:18 
AnswerRe: Casts Pin
Nibu babu thomas5-Jun-07 2:35
Nibu babu thomas5-Jun-07 2:35 
AnswerRe: Casts Pin
Rajkumar R5-Jun-07 2:37
Rajkumar R5-Jun-07 2:37 
AnswerRe: Casts Pin
jhwurmbach5-Jun-07 2:42
jhwurmbach5-Jun-07 2:42 
AnswerRe: Casts Pin
Matthew Faithfull5-Jun-07 2:42
Matthew Faithfull5-Jun-07 2:42 

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.