To understand this knowledge is due to a OutOfMemoryError exception, then the solution is to add the-xmx1024m parameter to expand the Java heap, but also add another parameter-xx:-usegcoverheadlimit. Although the problem solved, but still feel can understand a little more, so buy a book to see.Java Memory Area:The memory managed by the
Some of the basic types of "variables" defined in "Functions" and "reference variables" of objects are allocated in the stack memory of the function.When a variable is defined in a block of code, Java allocates a memory space for the variable in the stack, and when the scope of the variable is exceeded, Java "Automatic
Run-time data regionThe Java Virtual machine divides the memory it manages into several different data regions during the execution of a Java program. These zones have their own purpose, as well as the creation and destruction of time, and some regions exist as the virtual machine process starts, and some regions depend on the user thread's start and end to build
overflows typically occur after the old or perm segment garbage collection, and there is still no memory space to accommodate new Java objects.From the definition, it can be seen that the internal leakage is an inducement of memory overflow , not the only factor.Three, memory leakage of several scenarios:1. Long life
the JVM can use 2 different kinds of memory: heap memory and out-of-heap memory, heap memory is fully allocated and freed by the JVM, and if the program does not have defective code causing memory leaks, then you will not encounter java.lang.OutOfMemoryError this error. The
OLD or Perm segments, and there is still no memory space to accommodate new Java objects.
From the definition, we can see thatMemory leakage is a cause of memory overflow.Is not the only factor.
Iii. Memory leakage scenarios:
1. Long Life Cycle objects hold references of short life cycle objects
This is the
I. OverviewThe Java Virtual machine performs a Java program by dividing the memory it manages into several different data regions that have their own purpose and time for creation and destruction. The memory managed by the Java Virtual machine will include the following runt
1. Run-time data area
1.1 Program Counters
The program counter is a thread-isolated area where each thread has a separate program counter.
It is a small amount of memory space, the bytecode interpreter by changing the counter to select the next byte code instruction to execute, branch, loop, jump, exception handling, thread recovery and other basic functions need to rely on it to complete.1.2 Java Virtual
required statically.d) Static memory allocations are allocated on a schedule and are the responsibility of the compiler; Dynamic memory allocation is on demand and is the responsibility of the programmer.4. Example DescriptionClass A{int I;int J;} Class Testmemo{public static void Main (string[] args) {A aa = new A ();//(A *) malloc (sizeof (a));//New A (); Dynamic allocation of an area in the heap, being
**java Memory storage area and memory overflow exception (i) * *Java virtual machines in the course of executing a Java program will divide the memory that it manages into several different data regions that have their own purpose
Why do we often say that a primitive type passes a specific value, whereas an object passes an object's memory address? To figure out this problem, you need to figure out the stack memory and heap memory.Java memory is divided into stacks of memory and heap memory, the role
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
Introduction
Memory management has always been a proud and proud capital of the Java language, allowing Java programmers to fundamentally ignore the details associated with memory management and focus only on business logic. But there is no perfect good in the world, bringing convenience at the same time, it has intro
Java divides memory into two types, called stack memory, which is called heap 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 block of code, Java al
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
1: data area for Java Virtual runtimeProgram Counter : is a small piece of memory that can be viewed as the line number indicator of the byte code executed by the current thread . BYTE-code interpreter work is to choose the next one by changing the value of this counter to execute the bytecode instruction, branch loop jump exception processing thread reply, etc. will depend on this counter complete.The
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
The maximum memory that is supported by each version of the JDK in different operating systems is not the same, but can be tested in the following ways.
C:GT;JAVA-XMXXXXM (g)-version
where xxx is the maximum memory value, M (g) is the measurement unit of memory, if the command can correctly display the version of t
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
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.