Received message a system with a node due to memory overflow and downtime, the system middleware is WebLogic, the database of Oracle.
1. First Use IBM heapanalyzer to analyze the dump file at memory overflow, find the most memory-intensive request, and look at the code.
2. In the follow-up code found that the methods in this class are particularly simple, the single table of the additions and deletions, there is a query is very easy, there will be no operation of big data, so that the database is excluded from the problem.
3. Continue to look at this class, found that in this class when the initialization of the creation of 16 classes, the 16 classes created another class, the memory overflow that this is what it produced, need to prove.
4. Connect WebLogic with Jconsole, find a corresponding function, continuous press save button10 times, found that memory up more than 300 m, OK is this problem, in the case of concurrency will be problematic.
5. Improvement method: The principle of less work, remove the unused calls, and then put some classes in the method to reduce its scope.
This event reminds me of why there is not a lot of class storage, there are many calls nested, the convenience of writing code and performance must have a balance.
A diagnosis of 2014-5-22 Java.lang.OutOfMemoryError:Java heap space