I wrote the following little test when I was tracking a
OutOfMemoryError exception in the earlier release of
blackdown jdk.
I am trying it now using Jdk1.2.2 RC3. I'm running under
RedHat Linux 6.1 (glibc 2.1.2).
The test allocates and prints one million T2 objects. Each object
is released after the print() method. It has a finalizer that
bumps a static counter.
It runs fine until iteration #259656, then it crashes with a
Segmentation fault. This number stays constant even if I vary
the lengths of strings in the messages, etc.
Has anybody seen anything similar? Is this a known bug?
I'm writing a persistent service that uses a lot of fine-
grained objects, so this is important to me. Any help is
greatly appreciated.
----------
public class T2
{
String s;
static Runtime rt = Runtime.getRuntime();
static int numFinalized = 0;
public T2(String s)
{
this.s = s;
}
public void print()
{
System.out.println(s
+ ", final: " + numFinalized
+ ", total: " + rt.totalMemory() + ", free: "
+ rt.freeMemory());
}
protected void finalize()
{
numFinalized++;
}
public static void main(String args[])
{
for(int i = 0; i < 1000000; )
{
for(int j=0; j<1000; j++)
{
T2 t2 = new T2("t" + i);
t2.print();
t2 = null;
i++;
}
try { Thread.sleep(100); }
catch (InterruptedException ie) {}
}
}
}
-----------
Michael Maloney
Ilex Engineering, Inc.
Tel: 410.241.5248
Email: [EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]