classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Bug in java_nio_VMDirectByteBuffer.c


From: Archie Cobbs
Subject: Re: [cp-patches] Bug in java_nio_VMDirectByteBuffer.c
Date: Wed, 16 Mar 2005 09:10:25 -0600
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]