public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/15195] New: [win32] gcj leaks handles and memory until it crashes
@ 2004-04-29  0:45 ovidr at users dot sourceforge dot net
  2004-04-29  0:52 ` [Bug java/15195] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: ovidr at users dot sourceforge dot net @ 2004-04-29  0:45 UTC (permalink / raw)
  To: java-prs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug java/15195] [win32] gcj leaks handles and memory until it crashes
  2004-04-29  0:45 [Bug java/15195] New: [win32] gcj leaks handles and memory until it crashes ovidr at users dot sourceforge dot net
@ 2004-04-29  0:52 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-29  0:52 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-29 00:52 -------
This is a dup of bug 14751.

*** This bug has been marked as a duplicate of 14751 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15195


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-29  0:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-29  0:45 [Bug java/15195] New: [win32] gcj leaks handles and memory until it crashes ovidr at users dot sourceforge dot net
2004-04-29  0:52 ` [Bug java/15195] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).