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

Windows os::check_heap needs more information

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b127
    • CPU:
      generic
    • OS:
      windows

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: