A: 

Use HeapWalk, not _heapwalk.

Try locking the heap during your heap enumeration with HeapLock and HeapUnlock.

It certainly sounds like your function calls are modifying the Heap and invalidating the enumeration. Some vague advice, perhaps you can create a new Heap specifically for any memory needed by these function calls. This might require significant reworking of these static functions, I know.

Terry Mahaffey
Hi Terry, thank you for your answer!Following your suggestion, I played around using HeapWalk instead (i did the heap locking already actually).It feels that HeapWalk works more robustly. I could not reproduce any of the above mentioned behaviors. I think I'll stick with HeapWalk() now. Still a strange feeling of not understanding how I corrupt the heap during _heapWalk() but not during HeapWalk(), where actually I do the same things as described in my original posting.By the way, i am not aware of my static methods using any heap. I've got only stack variables there. Thanks anyways...
Stefan Hubert