From 54da05d84099388fa64414f8a761bd06b55bdf9f Mon Sep 17 00:00:00 2001 From: Ron Durbin Date: Thu, 15 May 2014 10:44:20 -0700 Subject: [PATCH] 8028749: java -version crashes with 'fatal error: heap walk aborted with error 1' Check_heap() should only call HeapWalk() when HeapLock() is successful. Reviewed-by: ctornqvi, sla, dcubed --- hotspot/src/os/windows/vm/os_windows.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index 35c2fcfed64..04b72a9d37d 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -5005,7 +5005,11 @@ bool os::check_heap(bool force) { // wrong; at these points, eax contains the address of the offending block (I think). // To get to the exlicit error message(s) below, just continue twice. HANDLE heap = GetProcessHeap(); - { HeapLock(heap); + + // If we fail to lock the heap, then gflags.exe has been used + // or some other special heap flag has been set that prevents + // locking. We don't try to walk a heap we can't lock. + if (HeapLock(heap) != 0) { PROCESS_HEAP_ENTRY phe; phe.lpData = NULL; while (HeapWalk(heap, &phe) != 0) {