public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "ovidr at users dot sourceforge dot net" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/15195] New: [win32] gcj leaks handles and memory until it crashes
Date: Thu, 29 Apr 2004 00:45:00 -0000	[thread overview]
Message-ID: <20040429004517.15195.ovidr@users.sourceforge.net> (raw)

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


             reply	other threads:[~2004-04-29  0:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-29  0:45 ovidr at users dot sourceforge dot net [this message]
2004-04-29  0:52 ` [Bug java/15195] " pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040429004517.15195.ovidr@users.sourceforge.net \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).