Home  >  Article  >  Java  >  What to do if java has insufficient memory

What to do if java has insufficient memory

coldplay.xixi
coldplay.xixiOriginal
2020-08-21 09:26:053784browse

Solution to insufficient Java memory: 1. Use the top command on Linux to view all processes, selectively kill large memory, and release memory; 2. Adjust the jvm memory configuration in tomca, such as changing the minimum memory Set it smaller.

What to do if java has insufficient memory

[Related learning recommendations: java basic tutorial

Solution to insufficient java memory:

1. Use the top command on Linux to view all processes to see which processes occupy too much memory. Selective kill to release memory, but this needs to be understood clearly. Resting processes is not necessary. .

2. Adjust the jvm memory configuration in tomca, because the main jvm memory refers to the jvm heap memory.

So the solution:

JAVA_OPTS="-server -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m"

Set the minimum memory of the above heap -Xms256 minimum memory to a smaller point, for example: before -Xms2048m. 2048M is too big, maybe the physical memory is not that big, so change it to -Xms256 (I adjusted it to 256). You can adjust it later as needed, or add memory modules.

The second solution I usually use is controlled within the scope of my own application.

JAVA_OPTS="-server -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m"

Where is it placed in linux?

cd Go to the /bin directory of tomcat and find the catalina.sh file

Related learning recommendations: Programming video

The above is the detailed content of What to do if java has insufficient memory. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn