Learn about garbage collection in java interview questions, we have the largest and most updated garbage collection in java interview questions information on alibabacloud.com
#. There are two types of memory in Java. are called stack (stack) and heap (heap), respectively.
Stack is the memory space of the program, so all the basic types and references to objects are in the stack.
Heap is a Java Virtual machine storage object, it is a huge memory, when you create an object, Java Virtual machine put objects into the heap, the creation
In-depth understanding of Java garbage collection mechanismOne: The significance of garbage collection mechanismOne notable feature of the Java language is the introduction of the Java
In-depth understanding of Java garbage collection mechanismOne: The significance of garbage collection mechanismOne notable feature of the Java language is the introduction of the Java
Before the Java language comes out, everyone is desperately writing C or C + + programs, and there is a great contradiction, C + + and other languages to create objects to continue to open up space, do not need to constantly release the control, not only write the constructor, but also write the destructor, A lot of times are repeated in the allocated, and then constantly ~ destruction. So, someone suggested, can write a program in the implementation
1. The most notable feature of the Java language is the introduction of a garbage collection mechanism, which allows Java programmers to write programs without taking into account memory management issues.2, because of this garbage colle
collectors
This collector divides the stack into two or more domains for storing objects of different lifetimes. A new object generated by the JVM is typically placed in one of the domains. Over time, objects that continue to exist will receive a lifetime and go into a longer-lived domain. The generational collector uses different algorithms for different domains to optimize performance.
(6) Concurrent collector
The concurrent collector runs concurrently with the application. These collectors g
memory into a number of different regions based on the life cycle of the object's survival. In general, the heap zoning is divided into the old age (tenured Generation) and Cenozoic (young Generation), the old age is characterized by a garbage collection only a small number of objects need to be recycled, and the new generation is characterized by each garbage
This article is from the "in-depth understanding of Java Virtual Machine," a book, it is very recommended that you look at this book. Other articles in this series:"In- Depth understanding of Java virtual machines" Java memory area model, object creation process, common oom1, garbage
Recently learned a Java garbage collection mechanism, the main content of the general summary:1. What is a garbage collection mechanismJava GC mechanism (garbage collection,
I. Who is doing garbage collection?
A popular saying: In C ++In Java, the system is doing garbage collection.JavaYou are doing it yourself.
In C ++,The memory is manually released. You must use the delete operator to release the allocated memory. This is a popular saying. Specifically, when an application deems that a
need to consider the recycling of the problem, because the end of the method or the end of the thread, the memory naturally with the recycling. While the Java heap and the method area are different, multiple implementation classes in an interface may require different memory, and multiple branches in one method may require different memory, we can only know when the program is running, which objects will be created, this part of the memory allocation
The garbage collection mechanism (GC) is one of the most important features of Java. It frees developers from the need to focus on the creation and release of memory, but instead automatically reclaims garbage (useless objects) through GC.Which memory needs to be recycledJava heap and method area is the main memory are
"Editor's note" The writer is Niv Steingarten, co-founder of Takipi, who is passionate about writing elegant and concise code.By introducing and combing the garbage collector, the author puts forward five suggestions on the management of garbage collection. Reduce collector overhead. Help you to further improve project performance. This article is a domestic ITOM
Vamei Source: Http://www.cnblogs.com/vamei Welcome reprint, Please also keep this statement. Thank you!There has been some knowledge of memory management and garbage collection in the entire tutorial. Here's a little summary.Java is run in a virtual memory environment of the JVM. Memory is divided into stacks (stack) and heaps (heap). We will examine these two areas separately.StackThe basic concept of the
When the garbage collector wants to reclaim objects, you first call the Finalize method of the class (you can write the program to validate the conclusion), and the normal Java-written class does not need to overwrite this method, because object has implemented a default, unless we want to implement a special function (which It involves a lot of things, such as object space tree and so on.But with classes w
In general, to write Java code, you basically do not need to hear the concept of garbage collection. This is no, for me who has written more than 5 years of Java code, I have not experienced any experience that requires the use of garbage
. When all the stacks are emptied, the program also ends with the run.HeapAs mentioned above, stacks can take care of themselves. But the heap has to be treated with care. A heap is an area of the JVM that can be freely allocated to objects. When we talk about garbage collection (garbage collection), we mainly recycle
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.