当前位置:网站首页>JVM garbage collection overview
JVM garbage collection overview
2022-07-06 17:14:00 【Smart popcorn】
Learning with problems is more conducive to focusing our attention , I bring questions to this chapter .
1. What is rubbish ?
Simple question , But often many people can't answer , This is a misunderstanding in thinking , Well, not much bb 了 .
simply , When an object is not pointed to by any reference , Then it becomes garbage , If a person is not needed by anyone , Then he is garbage ( The example is not good , The dog's head lives ).
When there is more garbage like this , Without being cleaned up in time , It is easy to cause memory overflow .
2. Why garbage collection is needed ?
Connect with life , If the garbage is always there , So over time , The room becomes a garbage dump , Can you still live ?
The same is true for programs , Eventually, the memory is exhausted , There are only a bunch of useless objects left , Wasted resources .
And once there is garbage collection , Useless objects are cleaned up , The extra space can store new objects .
3. Early memory management
We all know ,Java There is an automatic garbage collection mechanism , This is also C,C++ What programmers envy , Because they need to make a manual memory request , Memory free , And if you forget to release , Will cause memory leaks .
What is memory leak ?
If an object has no reference, it points to , That's the useless object , But for some reason , Not recycled , This is it. Memory leak .
4. Java Automatic memory management for
The automatic garbage collection mechanism makes us Java Programmers do not need to request or free memory , But it also weakens our ability to deal with memory overflow , So it is very important for us to understand the garbage collection mechanism , We can use some monitoring or tuning tools to solve the corresponding problems .
It needs to be emphasized here ,GC and OOM Only in heap space and method area , There is no mandatory regulation on garbage collection in the method area , There are some JVM In fact, there is no garbage collection in the method area , But our default HotSpot There will still be .
Garbage recycling focuses on the new generation , Less collected in the old age , Almost immovable method area , Remember !!!
边栏推荐
- The "advertising maniacs" in this group of programmers turned Tiktok advertisements into ar games
- yum install xxx报错
- TCP的三次握手和四次挥手
- Log4j2 major vulnerabilities and Solutions
- The 116 students spent three days reproducing the ByteDance internal real technology project
- Von Neumann architecture
- Activit零零碎碎要人命的坑
- SQL调优小记
- 一个数10年工作经验的微服务架构老师的简历
- Shell_ 04_ Shell script
猜你喜欢
Shell_ 06_ Judgment and circulation
Fdog series (I): think about it. It's better to write a chat software. Then start with the imitation QQ registration page.
Compile homework after class
Data transfer instruction
Shell_ 04_ Shell script
手把手带你做强化学习实验--敲级详细
Fdog series (III): use Tencent cloud SMS interface to send SMS, write database, deploy to server, web finale.
汇编语言寻址方式
Shell_ 03_ environment variable
JVM运行时数据区之程序计数器
随机推荐
姚班智班齐上阵,竞赛高手聚一堂,这是什么神仙编程大赛?
DS18B20数字温度计系统设计
How to generate six digit verification code
Some instructions on whether to call destructor when QT window closes and application stops
Activit零零碎碎要人命的坑
Install docker under windows10 (through Oracle VM VirtualBox)
ByteDance overseas technical team won the championship again: HD video coding has won the first place in 17 items
yum install xxx报错
Flink源码解读(一):StreamGraph源码解读
Activiti directory (III) deployment process and initiation process
Description of project structure configuration of idea
Mongodb在node中的使用
唯有学C不负众望 TOP3 Demo练习
Alibaba cloud server docker installation mysql5.5
關於Stream和Map的巧用
DOS function call
ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021
Yao BanZhi and his team came together, and the competition experts gathered together. What fairy programming competition is this?
After idea installs the plug-in, restart the plug-in and disappear
Flink 解析(七):时间窗口