2

I am using Java Spring ibatis

I have java based reporting application which displays large amount of data. I notice when system try to process large amount of data it throws "out of memory" error.

I know either we can increase the memory size or we can introduce paging in reporting application. any idea ? i am curious if there is some thing like if list object is large enough split it into memory and disk so we don't have to make any major change in the application code ?

any suggestion appreciated.

d-man
  • 53,999
  • 81
  • 200
  • 285
  • 1
    Well, what is "large" and how much memory have you allocated to the JVM? – OldProgrammer Oct 17 '14 at 14:45
  • 3
    is it possible you have a bad memory leak or something else? Just because you are getting an out of memory error doesn't necessarily mean your list is too big, it means you are out of memory. – Marshall Tigerus Oct 17 '14 at 14:48
  • If you have you too many classes or huge number of Strings in your project then you can easily run out of memory in Perm Gem, By default its size is restricted to 64 MB , you can increase the size by specyfying jvm options `export JVM_ARGS="-Xmx1024m -XX:MaxPermSize=256m"` . Although there can be more reasons to `OutOfMemory` error , this is my best shot given the details you provided – Mustafa sabir Oct 17 '14 at 14:52
  • 2
    First things first, do [this](http://stackoverflow.com/questions/542979/using-heapdumponoutofmemoryerror-parameter-for-heap-dump-for-jboss) and analyse the memory dump with a tool like MAT so that you know exactly why you run out of memory. – biziclop Oct 17 '14 at 15:28

1 Answers1

3

The first thing to do should be to check exactly what is causing you to run out of memory.

Add the following to your command line

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/where/you/want

This will generate a heap dump hprof file.

You can use something like the Eclipse Memory Analyser Tool to see which part of the heap (if at all) you need to increase or whether you have a memory leak.

user1717259
  • 2,429
  • 5
  • 26
  • 38