In the recent interview often asked about the JVM and memory allocation problems, I think it is necessary to learn to summarize the next ~ ~ ~One, Java memory areaIn Java, the virtual machine automates memory management, which divides the
Various areas of Java Virtual machine memoryThe role of these areas, the service objects and the problems that may arise, respectively. (Image from Network)1. Program counterA program counter is a small piece of memory that can be seen as the line number indicator of the bytecode that is being executed by the current thread. The function of bytecode interpreter is to change the value of the program counter
cause a memory overflow in that area, which is generally the error message when a memory overflow occurs in this area:Outofmemoryerror:permgem Space2. Thread Stack Overflow (java.lang.StackOverflowError)Thread stacks a piece of memory structure that is unique to threads, so a thread stack problem must be an error that occurs when a thread is running. Generic thr
One, Java Virtual machine memory partition1. Program counterThread PrivateCan be seen as the line number indicator of the byte code executed by the current thread . The bytecode interpreter works by changing the value of this counter to select the next byte-code instruction to execute.A Java Virtual machine is implemented through multi-threaded rotation and alloc
Java divides the memory into two types:A kind of called stack memoryA heap of memory calledStack Memory : Some basic types of variables and object reference variables defined in the function are allocated in the stack memory of the function. When a variable is defined in a
JVM will throw java if no more memory can be allocated to new objects. lang. outofmemoryerror: Your program will be replaced. Before throwing an OutOfMemoryError, JVM will try to use the Garbage Collector to free up enough space, but this error will be thrown when it finds that there is still not enough space. To solve this problem, you need to know the information of your program objects, such as the obje
There is a high wall between Java and C + + that is surrounded by dynamic memory allocations and garbage collection techniques, and people outside the walls want to go in, but the people inside the wall want to come out.Overview:Speaking of garbage collection (garbage Collection, hereinafter referred to as GC), most people regard this technology as the companion product of the
1. Types of Java referencesMemory management is divided into: memory allocation and memory reclamation. are handled automatically by the JVM.
The state of an object in memory: reachable, recoverable (call the Finalize method before recycling), unreachable
JVM Recovery criteria: whether there are referenc
same: can cause problems with the application running, degraded performance, or hangs.Vary1) memory leaks are one of the causes of memory overflow, and memory leaks accumulate to cause memory overflow.2) memory leaks can be avoided by perfecting the code, and
The previous time to learn the binary tree in the processing of the delete operation encountered a headache problem: the deletion of the node when it is clear that the node is still present on the tree, you must also execute Node.father.left = null, you can delete the node nodes, Looking for a reason to find out or because the Java memory management understanding is not deep enough.The code is as follows:@T
Java divides memory into two types: one is stack memory and the other is heap memory. Some of the basic types of variables and object reference variables defined in a function are allocated in the stack memory of the function. When a variable is defined in a block of code,
Java Memory Optimization Test, Memory Optimization Test
After two years of development in c ++, he was transferred to the java project last month. So the first article was about java memory optimization.
First of all, optimization
I drew a mind map of the memory area of Java and the main functions of each area.simulating Java heap overflowThe Java heap is used to store object instances, as long as the objects are constantly created and the GC roots to the object to avoid being purged by the recycle mechanism, the
I drew a mind map of the memory area of Java and the main functions of each area.simulating Java heap overflowThe Java heap is used to store object instances. It is only necessary to constantly create objects and ensure that the GC roots between objects has an accessible path to avoid being purged by the recycle mechan
Run-time data regionprogram Counter Register ): Can be thought of as the line number indicator of the byte code executed by the current program. In the virtual machine conceptual model (different virtual machines may have different implementations), the bytecode interpreter is to remove a bytecode instruction by changing the value of the program counter, and the basic functions such as branching, looping, jumping, exception handling, thread recovery, and so on, depend on this counter.Java Virtua
I stitched up a JVM memory graph from online search: as shown in:Let's consider a few questions:How does the 1.jVM work?How is the 2.JVM runtime memory allocated?3. In what area do we write Java code (classes, objects, methods, constants, variables, etc.) in the end?VM Run-time data region:1. Procedure counter (program Counter Register):is a small amount of
Java Memory Overflow DetailedOne, the common Java memory overflow has the following three kinds:1. Java.lang.OutOfMemoryError:Java heap Space----JVM heap (heap) overflowThe JVM will automatically set the JVM heap value when it is started, and its initial space (that is,-XMS) is 1/64 of the physical
Java stack Memory heapJava divides memory into two kinds, one called stack memory, and the other is called Heap memory, which has different functions. Stack memory is used to store local variables and method calls.Stack
An introductionSpeaking of final you must know that it is a keyword in Java, so what does it do in Java, you know? If you do not know, please go to this article to understand the next https://www.cnblogs.com/yuanfy008/p/8021673.htmlToday, let's talk about the memory semantics of the final domain in JMM.Re-ordering rules for final fieldsTo get to the point, for fi
The relationship between the main memory and the CPU, because the CPU is in the processing speed is too fast. So the general CPU has a CPU cache , which means the main memory---CPU cache---CPU Register---CPU execution processing, write the contrary.See, is the multi-threaded case of the Java operation variables of the approximate steps, it should be noted that
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.