|
Duplicate :
|
|
|
Duplicate :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
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);
|