memory management - how to solve java.lang.OutOfMemoryError -


getting below error in eclipse.

exception in thread "main" java.lang.outofmemoryerror: java heap space. 

can know how fix issue?

regards,
mahendra athneria

use less memory.

it's hard problem without knowing kind of application you're running. answer going contain general advice dealing problem.

use jvisualvm application comes jdk. allow connect running process , see breakdown of how memory being used.

look in results large numbers of objects should not there. if see there 20,000 instances of 1 class, math , see if there should many. object types have way more instances there should be. have figure out why have many.

these objects being created , not dereferenced. may putting them in data structure somewhere , not removing them. may have threads still running reference data aren't ending should. there sorts of reasons why may continuing reference data should garbage collected.

the key piece of information knowing object class exploding in quantity this. once know that, can override constructor , destructor of class log how many of them have been created , destroyed, , where. pouring through data, can determine objects being made, or not being destroyed. once correct problem, stop getting error.

of course, it's entirely possible data processing needs amount of memory. you've told nothing project, it's impossible judge accurately. if case, need figure out how partition data load part of @ time, process it, free memory, , move onto next chunk of data.

i've had these problems before , used of above techniques solve them.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -