Review request for 5049299

David Holmes - Sun Microsystems David.Holmes at Sun.COM
Fri May 22 11:18:16 UTC 2009


Hi Michael,

 > But the implementation in processhelper, does not know about JNI, so
 > it ignores the env

and doesn't throw the exception, which then begs the question as to what 
happens if malloc returns NULL in that case? If I understand you right, 
the jlup_* functions called from processhelper will use its jlup_xmalloc 
function, which simply returns malloc - but those jlup_* functions don't 
check for a NULL return because they "know" that xmalloc throws on 
out-of-memory.

David


Michael McMahon said the following on 05/22/09 21:05:
> Hi David,
> 
>>
>> In the Makefile:
>>
>> + HELPER_EXE = $(BINDIR)/processhelper$(EXE_SUFFIX)
>>
>> Isn't EXE_SUFFIX superfluous here? It has to be an empty string 
>> otherwise the Java code won't know the name of the helper.
>>
> Yes, it is superfluous. I took the pattern from another makefile,
> but it is probably better to remove it for maximum clarity.
>> In UnixProcess_md.c:
>>
>> 116 jlup_xmalloc(void *env, int size)
>>
>> Why did you have to lose the type of env ?
>> Why is this function defined differnetly in two files?
>>
> This malloc function is invoked in code that is common to the 
> UNIXProcess native code,
> and processhelper. The native code knows about JNI and it needs the JNI 
> env in order to
> be able to call  JNU_ThrowOutOfMemoryError((JNIEnv *)env, NULL);
> 
> But the implementation in processhelper, does not know about JNI, so it 
> ignores the env
> parameter, and in order to avoid including JNI header files in 
> processhelper I made
> it a void *, which is casted to a JNIEnv * in the other version.
> 
> Thanks,
> Michael
> 



More information about the core-libs-dev mailing list