1.outofmemoryerror:java Heap Space
Process: The server above the MySQL suddenly abnormal restart, causing the program to start the error when the
problem 1:outofmemoryerror:java Heap space
Resolution process:
1. View the error log for MySQL
Fix related tables and modify related parameter settings based on error log. The
Repair table uses the repair Table command.
Restart the program, still error: Issue 1.
2. Change the size of the buffer pool for MySQL
because the server has more than one area of service open, it may cause the program to run out of memory allocated. The
changes the innodb-buffer-pool-size size and changes according to the actual situation.
Restart the program, still error: Issue 1.
3. Change the size of the memory allocated by the JVM runtime. The
achieves the purpose of the setting by changing the JVM runtime initial setup parameters. The
-XMS-XMX-XMN parameters and GC recycle parameters are set.
Restart the program, still error: Issue 1.
Changes to 2.5G, the program started normally, but ran up for a period of time down. Due to low native memory.
4. Change the database to test. The
exports the import to build two new test libraries, using the data from this zone and other areas of the service.
Attach the game suit to this area the service still error 1. Hanging in another zone, you can start normally. The
estimates the problem with the table in the database.
5. The development group uses the program to run debugging on the computer, found that because of the two large tables in the database, has been in the infinite loop query, the results of the query into the memory of the JVM (because the two table data is larger), resulting in memory overflow.
Then, on this issue, the repair and debugging has been initiated. The
uses the previously backed up data to restore the two tables, and the results still don't work. Report the same mistake.
To delete two large tables, the program starts normally. Preliminary judgment because the program is querying these two tables, because the data is too large, and the program has been in the loop read into the memory caused by overflow.
As a result, the Java program makes adjustments and optimizations to handle big data. The
sets a cursor to restrict the Java program from fetching data each time, resulting in the program starting normally. After a day of testing, nothing else has happened. The
usecursorfetch=true&defaultfetchsize=1000
uses the above parameters to give the Java Program Data extraction rules when connecting to the MySQL database for optimal processing.
Game suit Java program starts, shows memory overflow