JDK-8148813 : Windows os::check_heap needs more information
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: generic
  • Submitted: 2016-02-02
  • Updated: 2016-08-04
  • Resolved: 2016-06-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b127Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
See JDK-8147481.

We need a simplified version of the following patch to log the last few entries of the "phe" structure. This information is useful in conclusively identify spurious errors reported by HealWalk/HeapValidate.

=================
 static int mallocDebugIntervalCounter = 0; 
 static int mallocDebugCounter = 0; 
 bool os::check_heap(bool force) { 
+#define SAVE_COUNT 100000 
+ static PROCESS_HEAP_ENTRY saved[SAVE_COUNT]; 
+ 
   if (++mallocDebugCounter < MallocVerifyStart && !force) return true; 
   if (++mallocDebugIntervalCounter >= MallocVerifyInterval || force) { 
     // Note: HeapValidate executes two hardware breakpoints when it finds something 
@@ -5242,9 +5245,14 @@ 
     // 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) { 
+ memset(saved, 0, sizeof(saved)); 
       PROCESS_HEAP_ENTRY phe; 
       phe.lpData = NULL; 
+ int saved_index = 0; 
       while (HeapWalk(heap, &phe) != 0) { 
+ if (saved_index < SAVE_COUNT) { 
+ saved[saved_index++] = phe; 
+ } 
         if ((phe.wFlags & PROCESS_HEAP_ENTRY_BUSY) && 
             !HeapValidate(heap, 0, phe.lpData)) { 
           tty->print_cr("C heap has been corrupted (time: %d allocations)", mallocDebugCounter);
Comments
The following has been added to os_windows.cpp for analyzing heap corruption errors. // For debugging possible bugs inside HeapWalk (a ring buffer) #define SAVE_COUNT 8 static PROCESS_HEAP_ENTRY saved_heap_entries[SAVE_COUNT]; static int saved_heap_entry_index;
03-08-2016