This content has been marked as final. Show 7 replies
A memory leak is a general case for heap space running out (note that 20mb is very low, that can't be correct). In Java a "memory leak" is the act of holding on to object references even after they are no longer used. It can also be caused by not calling some sort of close or cleanup method that is tied to native resources. Note that the XML thing can be a red herring, it is simply the spot that the JVM runs out of memory, it does not mean that it is the spot where memory is eaten up.
A profiler tool can help you find out which parts of your application are eating up memory which will be a likely spot to find dodgy code; if you are using an IDE there may be a profiler built into it.
And yeah there is always the possibility that the application during runtime simply needs more memory than you are giving it and you simply need to find the proper maximum heap space setting for things to remain stable. Setting min and max to the same number generally isn't a good idea, although that changes between garbage collector implementations.
thanks for your inputs.
Yes, the exception thrown is only the point where jvm has run out of memory
We had increased the setting to 70 MB in the server where this heap out of space is thrown.
however only the frequency of this issue is reduced.
Used jmap histo to analyze loaded Objects..It only highlights the char,string,byte objects instance that has consumed more memory. Couldn't derive solution from it..
The code mostly nullifies objects in finally block. There are dynamically class loading mechanism Involved in few cases.
The doubt is why it throws in one server and not in another, when the other parameters like JdK version, volume of orders it processes is approx same.?
How to check if garbage collection is invoked at certain intervals? Any command/config setting to check the difference in JVM GC setting between the servers?
The code mostly nullifies objects in finally block.Then the code is poorly written, and it therefore probably exhibits numererous other fallacies as well, some of which may be causing excess memory usage. Nulling out local references in finally blocks accomplishes precisely nothing, and strongly suggests that the authors lacked competence.