RFR(M): 8038201: Clean up misleading usage of malloc() in init_system_properties_values()

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Mon Mar 24 21:50:53 UTC 2014


please review and test this change. I please need a sponsor.

This change addresses the implementation of init_system_properties_values
on aix, linux, solaris and bsd.
In init_system_properties_values a macro was defined mapping malloc to
NEW_C_HEAP_ARRAY. NEW_C_HEAP_ARRAY checks for successful allocation
or exits the VM.  The code of this method handles the allocated pointers as
allocated with real malloc, i.e.,  there were checks for NULL and calls to free().

This change replaces the macro malloc with NEW_C_HEAP_ARRAY and removes
the unnecessary checks making the code clearer.  Also, it uses a local array where

The allocated memory is passed to calls that end up at SystemProperty::set_value().
set_value copies the strings passed.  Thus the memory allocated in
init_system_properties_values must be freed after these calls.  Most of these
frees were missing.

This change adds the missing frees.

Testing this change I ran into a warning in ppc code which I fixed, too.
I did some local test.  I'll get broader tests by Wednesday.

Best regards,

More information about the hotspot-dev mailing list