[Bug java/10920] New: Too many roots is reported for program, which shouldn't run out of memory
gcc-bugzilla@gcc.gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 21 22:37:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10920
Summary: Too many roots is reported for program, which shouldn't
run out of memory
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: oyvind.harboe@zylin.com
CC: gcc-bugs@gcc.gnu.org
In trying to track down a heap corruption problem (GDB has a warning
about heap corruption), I've stumbled across a weird failure.
"Too many root sets"
I think my test isn't eating memory, so why does the garbage
collector go gaga?
gcj --main=TestSerial ..\scripts\native\modified_swt.jar
..\scripts\native\comm.jar -fjni -o ..\scripts\native\test2.exe
TestSerial.java
The various files required for this test are too big to post,
but they can be downloaded here:
http://www.harboe.org/oyvind/rootsets.zip
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import javax.comm.CommPortIdentifier;
import javax.comm.NoSuchPortException;
import javax.comm.PortInUseException;
import javax.comm.SerialPort;
import javax.comm.UnsupportedCommOperationException;
public class TestSerial
{
public void run()
{
Display display = new Display();
final Shell shell = new Shell(display);
RowLayout layout = new RowLayout();
layout.justify = true;
layout.pack = true;
shell.setLayout(layout);
shell.setText("Hello GCJ World!");
Label label = new Label(shell, SWT.CENTER);
label.setText("Hello, GCJ World!");
Button button=new Button(shell, SWT.NONE);
button.setText("wweee!");
shell.pack();
shell.open ();
try
{
CommPortIdentifier portId =
CommPortIdentifier.getPortIdentifier("COM2");
SerialPort sPort = (SerialPort)
portId.open("transfer", 0);
try
{
sPort.setSerialPortParams(19200,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
sPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
InputStream sIn=sPort.getInputStream();
OutputStream
sOut=sPort.getOutputStream();
}
finally
{
sPort.close();
}
} catch (IOException e)
{
e.printStackTrace();
} catch (NoSuchPortException e)
{
e.printStackTrace();
} catch (PortInUseException e)
{
e.printStackTrace();
} catch (UnsupportedCommOperationException e)
{
e.printStackTrace();
}
shell.dispose();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep
();
}
display.dispose ();
}
public static void main(String[] args)
{
// avoid dependency on the silly javax.comm.properties
file
// works for Java Web Start *and* GCJ.
String driverName = "com.sun.comm.Win32Driver";
try
{
javax.comm.CommDriver commDriver =
(javax.comm.CommDriver) Class
.forName(driverName)
.newInstance();
commDriver.initialize();
} catch (ClassNotFoundException e)
{
e.printStackTrace();
} catch (InstantiationException e)
{
e.printStackTrace();
} catch (IllegalAccessException e)
{
e.printStackTrace();
}
for (int i=0; i<1000; i++)
{
System.out.println("Test " + i);
new TestSerial().run();
}
}
}
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the Gcc-bugs
mailing list