Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not sure if relevant to your problem, but I just had a similar problem with a Swing project using OpenJDK 7.</p> <p>After several cycles of starting (the <code>Run</code> button) and closing (<code>'X'</code> / <code>Alt+F4</code>) my application, I got this error in the console:</p> <pre><code>Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:691) at sun.awt.AWTAutoShutdown.activateBlockerThread(AWTAutoShutdown.java:334) at sun.awt.AWTAutoShutdown.notifyPeerMapUpdated(AWTAutoShutdown.java:215) at sun.awt.AWTAutoShutdown.registerPeer(AWTAutoShutdown.java:348) at sun.awt.SunToolkit.targetCreatedPeer(SunToolkit.java:313) at sun.awt.X11.XToolkit.createFrame(XToolkit.java:410) at java.awt.Frame.addNotify(Frame.java:477) at java.awt.Window.show(Window.java:1031) at java.awt.Component.show(Component.java:1651) at java.awt.Component.setVisible(Component.java:1603) at java.awt.Window.setVisible(Window.java:1014) at tool.BAT.main(BAT.java:11) </code></pre> <p>And sometimes, I got another sort of error:</p> <pre><code>Error occurred during initialization of VM java.lang.OutOfMemoryError: unable to create new native thread </code></pre> <p>and then, if I tried to run it once more, Java crashed:</p> <pre><code># # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x0000000000000000, pid=30388, tid=139776854689536 # # JRE version: 7.0_07-b30 # Java VM: OpenJDK 64-Bit Server VM (23.2-b09 mixed mode linux-amd64 compressed oops) # Problematic frame: # C 0x0000000000000000 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /home/mcmlxxxvi/workspace/bat/hs_err_pid30388.log # # If you would like to submit a bug report, please include # instructions on how to reproduce the bug and visit: # http://icedtea.classpath.org/bugzilla # </code></pre> <p><code>top</code> revealed the cause of the problem (notice virtual memory usage):</p> <pre><code>PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 30619 mcmlxxxv 20 0 3271m 390m 45m S 2.0 13.0 0:38.88 java 30667 mcmlxxxv 20 0 2172m 35m 12m S 0.3 1.2 0:01.00 java 30688 mcmlxxxv 20 0 2172m 35m 12m S 0.3 1.2 0:00.96 java 30710 mcmlxxxv 20 0 2172m 35m 12m S 0.0 1.2 0:00.97 java </code></pre> <p>These were all instances of my application, which had not been closed. Still not sure why so much virtual memory was allocated per instance - probably there's some option for that. (I have 3GiB of physical memory, by the way).</p> <p>Here's my main() method: </p> <pre><code>public static void main(String[] args) { JFrame frame = new JFrame(); //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 300); frame.setVisible(true); } </code></pre> <p>I saw the commented line in a tutorial and specifically disabled it to see what would happen. What happened was that that it defaulted to <code>HIDE_ON_CLOSE</code>, which did not close and dispose of the frame.</p> <p>Setting <code>setDefaultCloseOperation</code> to <strong>EXIT_ON_CLOSE</strong> was the solution for me. Interested to see input from more knowledgeable people on this, though.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload