Note that there are some explanatory texts on larger screens.

plurals
  1. PO_heapwalk reports _HEAPBADNODE, causes breakpoint or loops endlessly
    primarykey
    data
    text
    <p>I use _heapwalk to gather statistics about the Process' standard heap.</p> <p>Under certain circumstances i observe unexpected behaviours like:</p> <ul> <li>_HEAPBADNODE is returned</li> <li>some breakpoint is triggered inside _heapwalk, telling me the heap might got corrupted</li> <li>access violation inside _heapWalk.</li> </ul> <p>I saw different behaviours on different Computers. On one Windows XP 32 bit machine everything looked fine, whereas on two Windows XP 64 bit machines i saw the mentioned symptoms.</p> <p>I saw this behaviour only if LowFragmentationHeap was enabled.</p> <p>I played around a bit. I walked the heap several times right one after another inside my program. First time doing nothing in between the subsequent calls to _heapWalk (everything fine). Then again, this time doing some stuff (for gathering statistics) in between two subsequent calls to _heapWalk. Depending upon what I did there, I sometimes got the described symptoms.</p> <p>Here finally a question:</p> <p>What exactly is safe and what is not safe to do in between two subsequent calls to _heapWalk during a complete heap walk run?</p> <p>Naturally, i shall not manipulate the heap. Therefore i doublechecked that i don't call <code>new</code> and <code>delete</code>. However, my observation is that function calls with some parameter passing causes my heap walk run to fail already. I subsequently added function calls and increasing number of parameters passed to these. My feeling was two function calls with two paramters being passed did not work anymore.</p> <p>However I would like to know why. Any ideas why this does <em>not</em> happen on some machines? Any ideas why this only happens if LowFragmentationHeap is enabled?</p> <p>Sample Code finally:</p> <blockquote> <p><code>#include &lt;malloc.h&gt; </p> <p>void staticMethodB( int a, int b )<br> {<br> } </p> <p>void staticMethodA( int a, int b, int c)<br> {<br> staticMethodB( 3, 6);<br> return;<br> } </p> <p>... </p> <p>_HEAPINFO hinfo;<br> hinfo._pentry = NULL;<br> while( ( heapstatus = _heapwalk( &amp;hinfo ) ) == _HEAPOK )<br> { </p> <pre><code>//doing nothing here works fine //however if i call functions here with parameters, this causes //_HEAPBADNODE or something else staticMethodA( 3,4,5); </code></pre> <p>}<br> switch( heapstatus )<br> {<br> ...<br> case _HEAPBADNODE:<br> assert( false );<br> /*ERROR - bad node in heap */<br> break;<br> ... </code></p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload