logo       

Re: Bug in java_nio_VMDirectByteBuffer.c: msg#00128

java.classpath.patches

Subject: Re: Bug in java_nio_VMDirectByteBuffer.c

Archie Cobbs wrote:
Another common problem is using too many local native references, e.g.,
when creating and populating an array. You only get 16, and have to use
DeleteLocalRef() to free up the ones you don't need anymore.

Well, soon as I sent that I ran into exactly this problem. Don't have
time to fix it right now (and I'm sure there are others...)

In gnu_java_awt_peer_gtk_GdkPixbufDecoder.c, in the function
query_formats(), there is a loop where (*env)->NewStringUTF()
is invoked over and over again. There are two bugs actually:

1- The function exhausts the pool of local native references.
It should use DeleteLocalRef() to free them as it goes along.
2- It doesn't check for exceptions from any of the JNI functions
it invokes.

In my case, (*env)->NewStringUTF() threw an exception because of #1,
but the exception was not checked for because of #2, causing an
assertion failure. So just fixing #1 would fix the crash in practice.

For #2 it probably suffices for now to use assert() like is done earlier
in the function after the FindClass() call.

-Archie

__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise