Open GoogleCodeExporter opened 9 years ago
You should use Java 1.7 (or better) if you're working with the source code.
I don't know how you could get an Out-Of-Memory; Micropolis really doesn't use
much memory. If you're able to find out more, please let me know. (For
instance, can you replicate the issue with a save-file?)
Original comment by jason@long.name
on 2 Dec 2013 at 1:03
Using Java 1.7 I got OutOfMemoryExceptionError . I was bulldozing an area. But
I ran into this error while doing other things, or while idling. When I click
"Save City As", I get the same error message OutOfMemoryExceptionError and the
"Save City As" dialog box will not display.
While playing a different time, I saved the city every few minutes. When I got
OutOfMemoryExceptionError , The "Save City As" did not work. The regular "Save
City" worked. I closed the program. Then when I reopened the game and loaded
the city I was able to continue the game no problem, exactly where I left off.
Original comment by fazt...@gmail.com
on 8 Jan 2014 at 5:25
Attachments:
How very odd. From the screenshot, I gather this specific case was when you
released the mouse button for the bulldozer tool, right?
I wonder- do the errors only occur at times when a sound would be played? Do
you play with sounds enabled? If so, try turning sounds off (from the Options
menu), and play the game for a while. See if that eliminates the out-of-memory
errors.
Original comment by jason@long.name
on 8 Jan 2014 at 2:46
[deleted comment]
Yes, it happened when I released the mouse button and a sound played. Then I
click Dismiss, and the error comes back when the next sound tries to play, then
I click Dismiss. I suspect the boat wants to honk its horn so often. This time
I turned off Sounds and the error does not come back. But the game is in some
type of locked out mode, the save and load dialog boxes will not load and give
an error. If I turn sounds back on, the errors return, and they won't go away
even if I continuously click Dismiss. So ,then I close the game, reload the
file and everything is normal again.
Here is the entire error
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Unknown Source)
at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source)
at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source)
at micropolisj.gui.MainWindow.citySound(MainWindow.java:1600)
at micropolisj.engine.Micropolis.fireCitySound(Micropolis.java:271)
at micropolisj.engine.Micropolis.makeSound(Micropolis.java:2185)
at micropolisj.engine.ShipSprite.moveImpl(ShipSprite.java:54)
at micropolisj.engine.Sprite.move(Sprite.java:67)
at micropolisj.engine.Micropolis.moveObjects(Micropolis.java:2152)
at micropolisj.engine.Micropolis.animate(Micropolis.java:2139)
at micropolisj.gui.MainWindow$36.actionPerformed(MainWindow.java:1363)
at micropolisj.gui.MainWindow$37.actionPerformed(MainWindow.java:1385)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.WaitDispatchSupport$2.run(Unknown Source)
at java.awt.WaitDispatchSupport$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(Unknown Source)
at java.awt.Dialog.show(Unknown Source)
at javax.swing.JOptionPane.showOptionDialog(Unknown Source)
at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
at micropolisj.gui.MainWindow.showErrorMessage(MainWindow.java:1420)
at micropolisj.gui.MainWindow.access$300(MainWindow.java:28)
at micropolisj.gui.MainWindow$4.mouseReleased(MainWindow.java:225)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
This one won't go away
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Unknown Source)
at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source)
at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source)
at micropolisj.gui.MainWindow.citySound(MainWindow.java:1600)
at micropolisj.engine.Micropolis.fireCitySound(Micropolis.java:271)
at micropolisj.engine.Micropolis.makeSound(Micropolis.java:2185)
at micropolisj.engine.ExplosionSprite.moveImpl(ExplosionSprite.java:32)
at micropolisj.engine.Sprite.move(Sprite.java:67)
at micropolisj.engine.Micropolis.moveObjects(Micropolis.java:2152)
at micropolisj.engine.Micropolis.animate(Micropolis.java:2139)
at micropolisj.gui.MainWindow$36.actionPerformed(MainWindow.java:1363)
at micropolisj.gui.MainWindow$37.actionPerformed(MainWindow.java:1385)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Original comment by fazt...@gmail.com
on 9 Jan 2014 at 1:52
Do not try to continue using the game after the first crash. You'll have to
exit and restart Micropolis. Leave Sounds Off always, and I think you won't
experience any more crashes.
It seems in some environments (yours, in particular) the sounds are using up
some system resource and eventually causing the system to throw an "unable to
create native thread" error. I will review the sound playing code and see if I
can come up with any more ideas to try.
Original comment by jason@long.name
on 9 Jan 2014 at 2:51
Original comment by jason@long.name
on 9 Jan 2014 at 2:53
Ok. I found some evidence that indicates the audio clips must be explicitly
closed after they finished playing, otherwise after about 2000 or so times of
playing a clip the system will start throwing out-of-memory errors, like you
have been experiencing.
http://stackoverflow.com/questions/2792977/do-i-need-to-close-an-audio-clip
So I will write a patch and incorporate it into the next release. In the
meantime, you will have to play the game with Sounds disabled.
(In case you're wondering, I usually have sounds disabled when I play; that's
why I never experienced this bug myself.)
Original comment by jason@long.name
on 9 Jan 2014 at 3:10
Original issue reported on code.google.com by
ersim...@gmail.com
on 1 Dec 2013 at 1:31