[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in java.io.File.listInternal()
From: |
Archie Cobbs |
Subject: |
Bug in java.io.File.listInternal() |
Date: |
Thu, 11 Dec 2003 16:07:01 -0600 (CST) |
Hi,
Bug DB still down.. here's another bug report with patch.
The native function java.io.File.readInternal(), when scanning a large
directory, uses up too many native references. The JNI spec only guarantees
a native function up to 16 references; unfortunately this is sometimes
an overlooked fact.
The patch below (expanded to show context) should fix this particular
bug, but there may very well be other similar bugs elsewhere...
Cheers,
-Archie
__________________________________________________________________________
Archie Cobbs * Halloo Communications * http://www.halloo.com
--- java_io_File.c.orig Thu Dec 11 15:53:02 2003
+++ java_io_File.c Thu Dec 11 15:54:06 2003
@@ -665,35 +665,38 @@
return(0);
}
for (i = 0; i < filelist_count; i++)
{
/* create new string */
str = (*env)->NewStringUTF(env, filelist[i]);
if (str==NULL)
{
/* We don't clean up everything here, but if this failed,
something serious happened anyway */
for (i = 0; i < filelist_count; i++)
{
JCL_free(env,filelist[i]);
}
JCL_free(env,filelist);
return(0);
}
/* save into array */
(*env)->SetObjectArrayElement(env, filearray, i, str);
+
+ /* free native reference */
+ (*env->DeleteLocalRef(env, str);
}
/* free resources */
for (i = 0; i < filelist_count; i++)
{
JCL_free(env,filelist[i]);
}
JCL_free(env,filelist);
return(filearray);
#else /* not WITHOUT_FILESYSTEM */
return(0);
#endif /* not WITHOUT_FILESYSTEM */
}
- Bug in java.io.File.listInternal(),
Archie Cobbs <=