-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
None
-
beta
-
generic
-
generic
Name: ssR10077 Date: 05/10/2000
Native memory leak looks common for win32 and solaris. Ops are created in
initOps of X11SurfaceData and Win32SurfaceData but never freed.
The leak can be reproduced by following test.
import java.awt.*;
import java.awt.Event.*;
public class Buta_Choice extends Frame
{
protected Panel centerPanel = new Panel ();
protected GridLayout gridLayout = new GridLayout ( 6, 6, 5, 5 );
private Buta_Choice ()
{
super ();
centerPanel.setLayout ( gridLayout );
for ( int i = 0 ; i < 64 ; i++ )
{
Choice btn = new Choice ();
btn.add("ABCD");
centerPanel.add (btn);
}
add ( centerPanel, BorderLayout.CENTER );
setVisible ( true );
}
/******* test 1 ************/
public static void main(String[] args)
{
System.out.println ( "Key In Start" );
int i, j;
Buta_Choice buta;
for ( j = 0; j<10; j++)
{
System.out.println ( "Key In NEW" );
System.out.println ( "j = " + j);
buta = new Buta_Choice();
System.out.println ( "Key In dispose" );
System.out.println ( "j = " + j);
buta.setVisible(false);
buta.dispose();
buta = null;
System.gc ();
Runtime.getRuntime().runFinalization();
try {
Thread.sleep(50);
} catch (Throwable e) {}
}
System.gc ();
Runtime.getRuntime().runFinalization();
try {
Thread.sleep(10000);
} catch (Throwable e) {}
System.exit(0);
}
}
======================================================================