Details
-
Bug
-
Resolution: Fixed
-
P4
-
None
-
None
-
b15
-
ppc
-
aix
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.
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.