Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to garbage collect the JAVA virtual machine in Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article to share with you is about how to Java virtual machine garbage collection in Linux, Xiaobian feel quite practical, so share to everyone to learn, I hope you can read this article after harvest, not much to say, follow Xiaobian to see it.

JVM GC logs are written in substitution (>) rather than appending (>>), and the previous GC content is emptied the next time it is written to the same file. This causes us to restart JAVA services and lose historical GC logs.

-XX:+PrintGC

-XX:+PrintGCDetails

-XX:+PrintGCTimeStamps

-Xloggc:filename

Example

This writing will cause GC logs to be lost after JAVA service restart.

-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/data0/logs/gc.log

Here GC logs support two parameters: %p and %t:

%p will be replaced with the corresponding process PID

%t will be replaced with a time string in the format: Y-MM-DD_HH-MM-SS

In this way, no matter how you restart, GC history logs will not be lost.

The above is how to carry out garbage collection of JAVA virtual machine in Linux, Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report