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

ClassLoader.c produces incorrect OutOfMemory Exception when length is 0 (aix)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 19
    • Component/s: core-libs
    • Labels:
      None

      Description

      I see NullClassBytesTest.java failing on AIX due to an java.lang.OutOfMemoryError. This failure occurs when the test's custom classloader tries to call defineClass with a 0 length byte array.

      While investigating the issue, I discovered that the defineClass procedures implemented in ClassLoader.c throw OutOfMemoryErrors whenever malloc returns NULL. However, (from malloc's man page) "If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free()". On AIX, malloc returns NULL when size is 0, while on other platforms (I checked Linux/x86) it returns a valid memory address. So the OutOfMemoryError thrown on AIX is inaccurate.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tsteele Tyler Steele
              Reporter:
              tsteele Tyler Steele
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: