• Post Reply Bookmark Topic Watch Topic
  • New Topic

Probably Out of Memory  RSS feed

 
Omid Reza Abbasi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All.

I should write a project that has a "Craft" and it "Fire"s "Missile"s against "Alien"s. Everything was OK till Today! Today when i run the Project, after some seconds, the program slows down and finally locks.
I think the mass production! of "Aliens" causes that. (and i tested that. Affirmative!)

But Why this doesn't happened before today for this project (I swear that i didn't change Anything )?
And Of course, How should i FIX it?

I Uploaded the ENTIRE Project here: http://s000.tinyupload.com/index.php?file_id=85176636528474748240 !!
Thanks!
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Omid Reza Abbasi wrote:
But Why this doesn't happened before today for this project (I swear that i didn't change Anything )?
And Of course, How should i FIX it?


First, you can't fix what isn't a problem -- so, before you can fix it, you probably should/want to confirm that you are actually running out of memory first. Are you catching and ignoring your exceptions? ... otherwise, you should be getting out of memory errors thrown.


Regardless, with out of memory conditions, you have few options. Either use less memory, which can be accomplished by doing less stuff (have less "aliens"), or more efficiently do stuff (which of course, requires you to change your algorithm). Or you can buy (and then assign) more memory to your JVM. I also recommend not using swap to get more memory for your JVM. Swapped memory and the GC don't work well together.

Henry
 
Jim Venolia
Ranch Hand
Posts: 312
2
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javac gave some warnings, which I fixed. Program works fine for me. Code changes are below, google rcsdiff if you need to:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!