Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8148813

Windows os::check_heap needs more information

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • hotspot
    • b127
    • generic
    • windows

      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);

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: