• Post Reply Bookmark Topic Watch Topic
  • New Topic

out of memory error  RSS feed

 
sarathchandra chandala
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting a out of memory error, when I tried to increase the jvm size, then the problem is not coming for one program and for other it is still facing the same problem(both programs are having same logic almost for different purpose)
As I couldn't increase my jvm size according to my wish I tried to close all the objects that I am using in the program.what additional things I need to consider to overcome this problem?
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would advice you to do performance profiling of your applicaition using tools like OptimiseIt. You need to look for memory leaks in your code.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I tried to close all the objects that I am using in the program

What does this mean? Assuming you mean you have dereferened them, this does not free them from memory. If you need stuff to be shifted out of memory more fequently, have a look a configuring you JVm's garbage collector.

Why can't you increase the amount of memory available? Have you tried performance testing your app. to find out how much it needs?
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are on jdk 6, you can use this jvm option:

-XX:+HeapDumpOnOutOfMemoryError

This option will generate a head dump whenever there is an out of memory error. You can analyze the dump using jhat

More good links and tips on this blog entry. (The blog entry is specifically on jdk6)
 
Maciej Grula
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at following two issues:
1. database connections - always close result sets, connections if you use database data.
2. collections - always clear collections (lists, vectors, etc) when you don't need them anymore.

From my experience, that solves more than 80% of memory leak problems.
 
Jaffer Sadiq
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Outof memory only when it come when there is no memory for JVM....
Allocate the memory for your application..... And best thing is do the code profiling which will give you the better picture .... on your application memory leak... Due to that your JVM get squeez.....

Jaffer ....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!