From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32458 invoked by alias); 29 Apr 2004 00:45:24 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 32443 invoked by uid 48); 29 Apr 2004 00:45:24 -0000 Date: Thu, 29 Apr 2004 00:45:00 -0000 From: "ovidr at users dot sourceforge dot net" To: java-prs@gcc.gnu.org Message-ID: <20040429004517.15195.ovidr@users.sourceforge.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug java/15195] New: [win32] gcj leaks handles and memory until it crashes X-Bugzilla-Reason: CC X-SW-Source: 2004-q2/txt/msg00061.txt.bz2 List-Id: gcc version 3.4.0 20040316 & SWT 3.0M8 on WinXP. > gcj --main=HorribleLeaks HorribleLeaks.java libswt.a -I swt.jar import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class HorribleLeaks { public static int DELAY = 1; public static int cnt; public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setSize(400, 400); shell.open(); Thread t = new Thread() { public void run() { for (;;) { display.syncExec(new Runnable() { public void run() { if (++cnt % 10000 == 0) System.out.println(cnt); } }); } } }; t.setDaemon(true); t.start(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } } Enable: Windows Task Manager ->View->Handle Count Running this program will show in TaskManager that handles grow to over 2 million and memory increases continually until the above application crashes with this error: --- libgcj failure: CreateEvent() failed This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. --- see "org.eclipse.swt.widgets.Synchronizer.java" for the syncExec code. This problem only exhibits itself when you run display.syncExec from a thread other than the gui thread and therefore it is forced to switch running threads before executing the run() method. In a normal app, handles and memory increase slowly over time but this app's for loop displays the problem immediately. The app works fine in SUN's java with consistent memory use and handles. -- Summary: [win32] gcj leaks handles and memory until it crashes Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ovidr at users dot sourceforge dot net CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15195