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

XMLWordPrintable

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

      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.

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

              Created:
              Updated:
              Resolved: