At present, the garbage collection of commercial virtual machines uses the "generational collection" algorithm, which divides memory into "new generation" and "old age" according to the survival period of the object. Then according to the different years
The characteristics of the generation take different collection
Jstat-gccause pid 1 per grid 1 ms output resultsJstat-gccause PID 2000 per grid 2 seconds output result
S0-heap on Survivor space 0% of the area that has been used
S1-heap on Survivor Space 1% of the area that has been used
Eden area on e-heap percentage of space already used
Percent of space used in old spaces on o-heap
Percentage of space used in P-perm area
ygc-number of young GC occurrences from application startup to sampling
ygct– time (in seconds) for young GC from application
Reprint: http://youli9056.github.io/blog/types-of-java-garbage-collectors/
This article is the third of the Java Garbage Collection series, not original, translated from types of Java garbage collectors. Without the basics, read the first two Java garbage
that the object is assigned to be empty, it must be marked as recyclable, and it is possible that escape will occur.
1.2. Now let's take a look at some of the garbage collection algorithms 1.2.1. Before JDK1.2, the reference counter algorithm is used,
That is, when this class is loaded into memory, a series of information such as method area, stack, program counter, etc. is generated, when objects are crea
also need to modify the stack reference address of the copied memory. In the From or Eden region, the "Large Object" Bucket directly copies it to the "Old Generation ". Because the efficiency of "large objects" copying multiple times in the From and To areas is relatively low, they are directly added To the "Old Generation" To improve recycling efficiency.
For the garbage collection of the "Old Generation"
Garbage collector
Garbage collector for hotspot virtual machines
There is no provision in the Java Virtual Machine specification for how the garbage collector can be implemented, so different versions of the virtual machine provide a large difference in the garbage collector, and will provide the paramet
I believe in the same procedure. Apes often encounter garbage collection problems in their daily work or interviews, and are there any details in the dead of the dead of night on the JVM garbage collection mechanism? It doesn't matter if you don't have time to do it, because it will be smoothed out next.
I. Te
-sorting algorithm moves Objects Based on the tag-clearing algorithm. Therefore, the cost is higher, but the memory fragmentation problem is solved.Generational collection Algorithm
The GenerationalCollecting algorithm is based on the garbage collection algorithm obtained after object lifecycle analysis.
As we have d
Garbage collection algorithm
Tag-Purge algorithm
The most basic algorithm is the tag-purge (mark-sweep) algorithm. There are two stages of marking and purging: first marking out all objects that need to be recycled, and then uniformly reclaiming all tagged objects when the tag is complete. It is the most basic collection algorithm, because t
PHP's garbage collection mechanism is very important in any development language, and PHP's garbage collection mechanism allows developers to avoid memory leaks as much as possible during the development process, and to automatically reclaim variables by reference counting, but there are still memory leaks in certain,
list.
Gc. collect () returns the number of inaccessible objects. 4 equals two objects and their corresponding dict
Garbage collection is triggered in three cases:
1. Call gc. collect (),2. When the counter of the gc module reaches the threshold value.3. When the program exitsIv. Analysis of common functions of the gc ModuleThe gc module provides an interfa
Java garbage collection mechanism and java garbage collection
When it comes to Garbage Collection (GC), many people naturally associate it with Java. In Java, programmers do not need to worry about the problem of dynamic memory al
The first thing to say is garbage, what's the name garbage?All is garbage, also first,second, I am not against who, everyone here is rubbish!!!HotSpotWTF, hot pots? What about my grandmother's heat, heat,you know?In short, the hotspot is a Java virtual machine to follow the specification of a realization, it was not sun company, but another company, was later acq
Objective:Think first about the three things you need to do with garbage collection (garbage COLLECTION,GC)1) What memory needs to be recycled?2) When is it recycled?3) How to recycle?The previous blog mentions the various parts of the Java Memory Runtime area, where the program counter, virtual machine stack, local me
associated with GC Root after the accessibility analysis, it is marked for the first time. The garbage collection of the permanent generation mainly recycles two parts: obsolete constants and useless classes Determine if a class is a "useless class" to satisfy the following 3 conditions: (1) All instances of the class have been reclaimed, that is, no instance
experience, the vast majority of object creation will soon be discarded and have a short lifespan.、Above is an example.As you can see, the objects that are still being referenced are getting smaller over time. Most objects have a very short life cycle.Based on the above analysis, the performance of the JVM can be improved by the method of heap generation (generations). Heap memory is divided into three chunks: young Generation, older (old Generation)
algorithm is used by JVM, but any garbage collection algorithm generally requires two basic tasks: (1) discovering useless information objects; (2) reclaim the memory space occupied by useless objects so that the space can be used by the program again.
1. Reference Counting Collector)
1.1 algorithm analysis
Reference count is an early policy in the
Articles in the JVM series (II): Garbage collection mechanism and jvm garbage collection
As a programmer, it is far from enough to know how to use it. At least, you need to know why it can be used, that is, what we call the underlying layer.
So what is the underlying layer? I don't think this can be generalized. In my
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.