The use of volatile in singleton mode
Singleton mode
The common writing methods of single case mode include lazy mode, hungry mode, double check mode, etc.
Lazy mode is to create objects when you use them.Hungry man mode is a static object that has been loaded in advance.Double check mode is to check twice before and after locking to prevent multiple threads from creating multipl ...
Posted by Alk3m1st on Tue, 04 Jan 2022 07:08:01 +0100
JVM class loading mechanism
From the overall logic of the JVM in the previous article, this article will talk about the class loading mechanism
Review some working models: one we wrote ourselves java file, compiled and generated Class file, will The class file is loaded into the JVM according to The different data information of the class binary file is allocated to ...
Posted by Xadian on Tue, 28 Dec 2021 06:20:00 +0100
You will know why interviewers like to ask such questions!
You will know why interviewers like to ask such questions!
One day, Zhang San went to an interview and was asked a question by the interviewer:
What is multithreading? Zhang San: multithreading means that multiple threads execute on the CPU, seize CPU resources and improve CPU execution efficiency
Interviewer: what are you talking about? W ...
Posted by Xianoth on Tue, 28 Dec 2021 02:01:04 +0100
Actual combat: memory allocation and recycling strategy
1. Objects are allocated in Eden first
In most cases, objects are allocated in the Cenozoic Eden district. When the Eden area does not have enough space for allocation, the virtual machine will initiate a Minor GC
Parameters:
-verbose:gc -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8
Indicates that the Java heap is 20MB, 10 ...
Posted by ManicMax on Mon, 27 Dec 2021 21:45:44 +0100
JVM memory allocation guarantee mechanism
catalogue
Guarantee mechanism
Case 1: the new generation is unable to allocate memory, is promoted to the old age, and guarantees success
Result 1: use the Serial collector
Result 2: use the ParallelScavenge collector
Case 2: Parallel Scavenge promotion condition: when the memory to be allocated is less than or equal to half of the memory ...
Posted by jahstarr on Mon, 27 Dec 2021 12:07:08 +0100
[JVM] explain the principle and implementation of HotSpot, heap and OOM in detail
catalogue
Reference articles
Three JVM s
1.Sun HotSpot
2.BEA JRockit
3.IBM J9 VM
Heap
Partition of heap memory
Evolution of permanent generation
Method area and permanent generation / meta space
Trigger conditions for Minor GC and Full GC
OOM(Out Of Memory)
Common configuration parameters of JVM heap
...
Posted by anatak on Sat, 25 Dec 2021 23:38:49 +0100
How to deal with Netty out of heap memory leakage?
1, Background
During the development process, we encountered the problem of out of heap memory leakage - the service will fake death (it seems that the service process is still running, but there is no business response). Check the error log of logback and record the following information:
[location-center:192.168.5.14:8017] [,] 2021-07-2 ...
Posted by tmc01 on Fri, 24 Dec 2021 20:39:03 +0100
Java Performance Definitive Guide Reading Notes
JIT just in time compiler
JIT (Just In Time) Just In Time compiler
server compiler and layered compilation should be used for all applicationsAs long as the code cache is large enough, the compiler can provide perfect performance
Code cache
Generally, you only need to set the maximum value of the code cache: - XX: reservedcodachesize. The J ...
Posted by aufkes on Fri, 24 Dec 2021 13:23:08 +0100
JVM fault handling tool, Usage Summary
1, Foreword
How to learn if you can't use it?
Without scenes and demands, it seems that there is no need to learn these knowledge points.
In fact, the best way is to summarize, sort out, practice and output. After a set of combination boxing, you will master this series of knowledge.
However, it may not be used at the current stage. The ...
Posted by jreed2132 on Wed, 22 Dec 2021 18:25:02 +0100
Self taught JVM 1. Loading mechanism of JVM classes from JDK source code board
1, General flow of java command execution code:
The loadClass class loading process includes the following steps:
Load = > verify = > prepare = > parse = > initialize = > use = > unload
Load: find and read bytecode files on the hard disk through IO. The class used will be loaded. In the loading phase, a Java. Net file r ...
Posted by iantresman on Wed, 22 Dec 2021 02:35:35 +0100