Question

After running 24 hr of my java program it shows exception like this "Exception in thread 1 Out of Memory Error Java Heap Size" , in my code i am using collection objects like hashmap, array list , vector and all.

This Problem is coming in the section of my code where i'm taking 500 data creating 500( in my db table 90000 data) HashMap at a time & setting this hashmap object into the ArrayList> in finally block i'm setting hashmap object null and passing this arralist object to another method for processing .This is continuing till the 90000 data.

For doing this processing program i'm using thread & from run() method of thread giving while condition true & calling dataprocessing method.

Was it helpful?

Solution

This means your heap is full. You have too many and/or heavy objects in memory.

Possible causes:

  1. you keep references to unused objects, and create too many of them
    Solution: check for memory leaks

  2. you actually need all those references, but your heap is too small
    Solution: increase the heap

Since your exception happens after a long time, I believe the first one is probably your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top