In addition to everything else, I have to say that even if you can reproduce the OutOfMemory error and find out where it occurred, you probably did not find anything worth knowing.
The problem is that OOM occurs when distribution cannot take place. However, the real problem is not that the distribution, but that other distributions in other parts of the code were not allocated (removed links and garbage collection). An imperfect distribution here may not have anything to do with the source of the problem (no pun intended).
This problem is more in your case, as it may take several weeks before the start of the crash, offering either a rarely used application, or an abnormal code path, or a relatively HUGE amount of memory in relation to what would be necessary if the code were OK.
It might be nice to ask why this amount of memory is configured for JBoss, and not something else. If recommended by the supplier, they may already be aware of the leak and require that this mitigate the consequences of the error.
For this kind of error, it’s really worth having an idea of which way the code is causing the problem, so you can do targeted tests. And check with the profiler so that you can see at runtime which objects (lists, maps, etc.) are growing without reduction.
This will give you the opportunity to decompile the correct classes and see what is wrong with them. (Closing or clearing in a try block, not possibly a finally block).
In any case, good luck. I think I would rather find a needle in a haystack. When you find the needle, you at least know that you found it :)
source share