src/os/windows/vm/os_windows.cpp
Print this page
@@ -5005,20 +5005,30 @@
// To get to the exlicit error message(s) below, just continue twice.
HANDLE heap = GetProcessHeap();
{ HeapLock(heap);
PROCESS_HEAP_ENTRY phe;
phe.lpData = NULL;
+ bool did_first_heapwalk_call = false;
while (HeapWalk(heap, &phe) != 0) {
+ did_first_heapwalk_call = true;
if ((phe.wFlags & PROCESS_HEAP_ENTRY_BUSY) &&
!HeapValidate(heap, 0, phe.lpData)) {
tty->print_cr("C heap has been corrupted (time: %d allocations)", mallocDebugCounter);
tty->print_cr("corrupted block near address %#x, length %d", phe.lpData, phe.cbData);
fatal("corrupted C heap");
}
}
DWORD err = GetLastError();
- if (err != ERROR_NO_MORE_ITEMS && err != ERROR_CALL_NOT_IMPLEMENTED) {
+
+ // - Always ignore the errors ERROR_NO_MORE_ITEMS and
+ // ERROR_CALL_NOT_IMPLEMENTED
+ // - Only ignore the error ERROR_INVALID_FUNCTION on
+ // the first call to HeapWalk
+
+ if (err != ERROR_NO_MORE_ITEMS &&
+ err != ERROR_CALL_NOT_IMPLEMENTED &&
+ (did_first_heapwalk_call && err == ERROR_INVALID_FUNCTION)) {
fatal(err_msg("heap walk aborted with error %d", err));
}
HeapUnlock(heap);
}
mallocDebugIntervalCounter = 0;