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

checking MallocMaxTestWords in testMalloc() function is redundant

    XMLWordPrintable

Details

    • b25
    • generic
    • generic

    Backports

      Description

        The testMalloc() function is guarded by the MallocMaxTestWords flag:

        + if (MallocMaxTestWords > 0) {
        + ptr = testMalloc(alloc_size);
        + } else {
        + ptr = (u_char*)::malloc(alloc_size);
        + }

        so the checks of the MallocMaxTestWords flag in testMalloc() are redundant:

        + if (MallocMaxTestWords > 0 &&
        + (cur_malloc_words + (alloc_size / BytesPerWord)) > MallocMaxTestWords) {
        + return NULL;
        + }
        +
        + u_char* ptr = (u_char*)::malloc(alloc_size);
        +
        + if (MallocMaxTestWords > 0 && (ptr != NULL)) {
        + Atomic::add(((jint) (alloc_size / BytesPerWord)),
        + (volatile jint *) &cur_malloc_words);
        + }

        We (the review team) missed this during all the code motion of the
        various review rounds.

        Attachments

          Issue Links

            Activity

              People

                rdurbin Ron Durbin (Inactive)
                dcubed Daniel Daugherty
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: