object to null.
Vector v=new Vector(10);for (int i=1;i{ Object o=new Object(); v.add(o); o=null; }
// At this time, all object objects are not released because variable v references these objects.
How to detect memory leakage
The last important issue is how to detect Java memory leaks. Currently, we usually use some tools to check the
The opening crap .Today we are working together to learn the memory allocation of the JVM, the main purpose is to lay the foundation for our Android memory optimization.have been thinking in what way to present this knowledge point can make us easy to understand, the final decision to use the method is: schematic + source code Analysis .Welcome to my personal blog: Senduo ' s blogWe would like to be able to
object, the JVM will throw java.lang.OutOfMemoryError and your program will be dropped. Before throwing the OutOfMemoryError, the JVM tries to use the garbage collector to free up enough space, but when it finds that there is still not enough space, it throws the error. To solve this problem, you need to know the information about your program object, for example, what objects you created, what objects took up a lot of space, and so on. You can use the prof
. These tools include Optimizeit Profiler,jprobe profiler,jinsight, Rational company Purify, etc. below, we will briefly describe the basic functions and working principles of Optimizeit. Optimizeit Profiler version 4.11 supports Application,applet,servlet and Romote application four class applications and can support most types of JVMs, including the Sun JDK se
Overview
Run-time data region
Program counter
Java Virtual Machine stack
Local method Stack
Java heap
Method area
Run a constant-rate pool
Direct Memory
Hotspot Virtual Machine Object Quest
Creation of objects
Memory layout of the object
memory. As soon as the maximum heap memory set by-XMX is reached, if no more memory can be allocated to the new object, the JVM throws java.lang.OutOfMemoryError, and your program is dropped. Before throwing the OutOfMemoryError, the JVM tries to use the garbage collector to free up enough space, but when it finds that there is still not enough space, it throws
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
set the vector object to null.
Vector v=new Vector(10);for (int i=1;i
// At this time, all object objects are not released because variable v references these objects.
How to detect memory leakage
The last important issue is how to detect Java memory leaks. Currently, we usually use some tools to check the memory lea
After you understand the runtime data area of a Java virtual machine, you have a general overview of the virtual machine's memory, what's in memory, and then you'll learn about other details of the data in memory, how to create it, how to lay it out, and how to access it. Here the virtual machine takes hotspot as an ex
visible to thread 1, so the normal variable is not guaranteed to be visible .When you put the variable stop with the volatile modifier, the main thread modifies the stop variable to be immediately visible to thread 1 and terminates the program, which proves that the volatile variable is of a visibility nature . The following modified results.Atomic properties have been made clear (for arbitrary (including 64-bit long and double types) of a single volatile variable read/write has atomicity), rem
One, Java memory area The 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 v
1 Java Virtual machine-to-memory management Java virtual machines divide memory into a number of different zones when executing Java programs, each of which has its own different uses, as well as the creation and destruction times. Some zones start with the start of a virtua
Java Virtual Machine-Java memory area, java-java
A Brief Introduction to the memory area of Java:
Data Area During Running
HotSpot Virtual Machine objects
I. Overview
2. Data area 2.
Original link: http://www.cnblogs.com/laoyangHJ/archive/2011/08/17/gc-Stack.htmlDrill down into Java Virtual machines: stacks and heap in the JVMIn the JVM, memory is divided into two parts, stack (stack) and heap (heap), where we know the stack and heap from the perspective of the memory management principle of the JVM, and these principles recognize the problem
Java divides memory into two types: one is stack memory and the other is heap memory.Some of the basic types of variables and 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
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
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
Java heap and stack Java divides memory into two types: one is stack memory, the other is heap memory.
Some of the basic types of variables and reference variables defined in the function are allocated in the stack memory of the
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.