and the recovery rate. A good GC implementation allows the user to define the settings they need, such as some memory-constrained devices, which are very sensitive to memory usage, and want the GC to be able to accurately reclaim memory, which does not care about the speed of the program. In addition to some real-time online games, it is not possible to allow lo
Become a Java GC expert (5)-Java Performance Tuning principle, gc Tuning
Not every program needs optimization. If the performance of a program is the same as expected, you don't have to put extra effort into improving its performance. However, after the program debugging is completed, it is difficult to immediately meet its performance requirements, so we have to tune the job. Regardless of the programming
physical memory, 32-bit machine up to 2G5) configuration parameters:-xms64m (min)-xmx64m (max)-xmn16m (Cenozoic size)Gc1. GC is divided into the new generation GC and the old generation GC, the new generation GC is also called minor GC. When the old generation
Preface
Previous articles, especially when it comes to GC, refer to a number of concepts, such as memory overflow and memory leaks, parallelism and concurrency, client mode and server mode, Minor GC and full GC, and this article explains in detail the differences between these concepts.
the difference between memory overflow and memory leak
1, Memory overflow
Me
user program and consumes the CPU at run time. When the GC process is running, the application stops running. Therefore, when the GC is running for a long time, the user can feel the pause of the Java program, on the other hand, if the GC is running too short, the object recovery rate may be too low, which means that there are many objects that should be recycle
user to define the settings they need, such as some memory-constrained devices, which are very sensitive to memory usage, and want the GC to be able to accurately reclaim memory, which does not care about the speed of the program. In addition to some real-time online games, it is not possible to allow long interruptions to the program.Incremental GC is the use o
Python Memory leakage and gc module Usage Analysis, python leak gc Module
Generally, in Python, object reference counting is used to solve Memory leakage and automatic garbage collection is implemented based on reference counting.Because Python has the automatic garbage collection function, many beginners mistakenly believe that they have lived a good life and do not have to be disturbed by memory leaks. Ho
space as well as the user program and consumes the CPU at run time. When the GC process is running, the application stops running. Therefore, when the GC is running for a long time, the user can feel the pause of the Java program, on the other hand, if the GC is running too short, the object recovery rate may be too low, which means that there are many objects t
Let's take a look at the code section:Java codeImport java. util .*;Public class SummaryCase {Public static void main (String [] args) throws Exception {List For (int I = 0; I Caches. add (new byte [1024*1024*3]);}Caches. clear ();For (int I = 0; I Caches. add (new byte [1024*1024*3]);}Thread. sleep (10000 );}}How many times will Minor GC and Full GC be executed when I use-Xms30m-Xmx30m-Xmn10m-XX: + UsePara
user to define the settings they need, such as some limited memory devices, very sensitive to memory usage, and the hope that the GC can accurately reclaim memory, and it doesn't care about slowing down the program. In addition to some real-time online games, it is not possible to allow long interruptions to the program. Incremental GC is the use of a certain re
GC algorithm and category
(i) the concept of GC
GC, refers to the ganbage Collection garbage collector. the GC algorithm mainly divides into four kinds: the reference counting method, the marking elimination, the marking compression, the duplication algorithm. Each of these algorithms is described below.
(II)
space like the user program, and CPU usage during runtime. the application stops running when the GC process is running.Line. Therefore, when GC runs for a long time, you can feelJava program pauses. On the other hand, if the GC running time is too short, the object recovery rate may be too low, which means that many objects that should be recycled are not recyc
① first of all, the GC inside the JVM is used in the root algorithm, the root algorithm, what is called the root, that is, the static members of the class, static members is the type static decoration, is the "root" of one, the root also includes the member variables in the method, only members or objects are not hanging on the root, GC when it is possible to get rid of them, referred to in the circular ref
the hope that the GC can accurately reclaim memory, and it doesn't care about slowing down the program. In addition to some real-time online games, it is not possible to allow long interruptions to the program. Incremental GC is the use of a certain recovery algorithm, a long interruption, divided into a number of small interruptions, in this way to reduce the i
Let's start with the idea of the Accessibility analysis algorithm: Starting with an object called GC roots, if an object is connected to a GC roots without any reference chain, then this object is not available.
There are several types of objects that can be used as GC roots in Java:
Objects referenced in the virtual machine stack, object referenced by the meth
reduce the amount of garbage to be recycled.
Garbage collection does not guarantee that memory will always have space to create new objects. For example, if we keep creating objects and placing them in a list, we cannot create new objects without enough space to create new objects and no objects that are not referenced. If we keep the list of references to objects that we no longer need, we can create a memory leak. Garbage collection solves many, but not all, memory allocation problems.
inte
running. Therefore, when GC runs for a long time, the user can feel the pause of the Java program. On the other hand, if the GC run time is too short, the object recovery rate may be too low, this means that many objects that should be recycled are not recycled and still occupy a large amount of memory. Therefore, we must weigh the pause time and recovery rate when designing
One GC problem locating and GC problem locating
A colleague has a code segment that takes too long to execute and needs to be optimized,
Hashmultimap
In the beginning, we thought it was caused by low doCompute efficiency in the computing process. Therefore, we wanted to optimize computing in various ways, such as computing in advance, multithreading, and ,.... And so on. The final result is as follows:
//
The GC algorithm evolved slowly, evolving into the current generational GC. Its evolutionary process labeling-clearing algorithm –> tag-copy algorithm –> marker-collation algorithm –> the generational algorithm.Before we introduce the algorithm, we know that Java is dynamic loading. Its characteristics:1. Hierarchical relationship, by Bootstrap class loader–> Extension class loader, System class loader (APP
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.