Discover how to detect memory leak in java, include the articles, news, trends, analysis and practical advice about how to detect memory leak in java on alibabacloud.com
Today, to visit the Java Concurrent Programming network, see a Translation Solicitation order, the author of the concurrent programming network from the StackOverflow website selected some classic questions and answers, so decided to translate a fewSolicitation Address: http://ifeve.com/stackoverflow-assembly/Translation Series articles:Some design patterns in the 1.Java Core class library2. The difference
Objective
See a problem on the Segmentfault: Java has a perfect GC mechanism, then in Java will be a memory leak problem, and can give a memory leak case. The full answer to this question is given in the view of this question.
I
memory leak definition: an object or variable that is no longer used by the program also occupies storage space in memory.
Because the Java JVM introduced the garbage collection mechanism, the garbage collector automatically reclaims objects that are no longer in use, knowing that the JVM recycling mechanism knows that
we do not need, not in use of goods, these items crowding out the space we need,And let's have the idea of discarding it to free up more space.There are two very important benchmarks in this understanding of rubbish, one is the object and the other is space.1. Heap Memory:In Java, the object corresponds to "objects", and space is "Java Heap memory" (created at J
There is no memory leak in the Java store. We first need to understand what a memory leak is. Memory leaks in Java in short, the object is used up, and the
Q: How can a memory leak be generated in Java?In A:java, there are many reasons for memory leaks. A typical example is a failure to implement Hascode andThe case where the key class of the Equals method is saved in HashMap. A lot of duplicate objects will be generated at the end. All the
One, the problem arisesProject AdoptionTomcat6.0 for server, the database ismysql5.1, the database persistence layer ishibernate3.0, tospringMVC3.0 for Frames, after the completion of project development, on the eve of the stability of the machine, the test data is inserted4 article/S, update4 article/S, Access300 plays/S, smooth running speed, and it starts running slowly after three days., the number of visits reached1500W Times to throwJava Heap Space Ends.Two 1. Pre-analysis for connection
Java programs can also cause memory leaks are open to the secret of the work need to give full attention to the problem.
There are a number of tools on the market for Java memory detection, and I use JBuilder's optimize tools in my work, and now I've done the following on the most recent project and experience using o
One, the problem arisesProject AdoptionTomcat6.0 for server, the database ismysql5.1, the database persistence layer ishibernate3.0, tospringMVC3.0 for Frames, after the completion of project development, on the eve of the stability of the machine, the test data is inserted4 article/S, update4 article/S, Access300 plays/S, smooth running speed, and it starts running slowly after three days., the number of visits reached1500W Times to throwjava heap space ends Two 1. Pre-analysis for connectio
One, the cause of the Java memory leak:A memory leak refers to a useless object (an object that is no longer being used) that keeps memory or useless objects from being released in a timely manner, resulting in a waste of memory s
First, the problem arisesThe project uses Tomcat6.0 as the server, the database is mysql5.1, the database persistence layer is hibernate3.0, takes the springMVC3.0 as the framework, after the project development completes, the line Eve carries on the stability to copy the machine, the test data is inserts 4 strips/s, updates 4 strips/s, Access 300 times/S, the pre-run speed is smooth, three days after the start of slow, traffic reached 1500W times to throw J
A memory leak is an object or variable that is no longer being used by the program and consumes storage space in memory.In the Java language, there are two criteria for determining whether a memory space is eligible for garbage collection :① gives null value to the object and has not been used in the future;② assigns a
Java memory leaks
There are generally two cases of memory leaks. A situation such as in the C + + language, the allocated memory in the heap, when it is not released, erase all Access to this memory (such as pointer redistribution), and the other is to retain the
Yes. The reason Java causes memory leaks is clear: a long lifecycle object holds a reference to a short lifecycle object and is likely to have a memory leak, although the short lifecycle object is no longer needed, but because the long lifecycle object holds its reference and cannot be reclaimed, this is the scenario w
Is there a memory leak in Java? Yes. While some people say that this is inaccurate, in C + + programs, the memory that is opened up by the current process but not logically managed by the current process is called memory that is leaked by the process. In fact,
A few days ago wrote a memory leak article. This article describes the memory leaks related knowledge: http://blog.csdn.net/u010590685/article/details/46973735But the sample given here is not very good, see a very good example here today to add to everyone.If we write a stack by ourselves. Here's how it's pop: publicpop(){ Object object=arrays[size];
A few days ago wrote a memory leak of the article, which describes the memory leaks related knowledge: http://blog.csdn.net/u010590685/article/details/46973735But the example given here is not very good, see a good example here today to add to everyone.If we write a stack ourselves, here is the Pop method: publicpop(){ Object object=arrays[size];
I. Memory leaks due to expired referencesNote: When the object is not used, the object is set to NULL, and this time the virtual machine does not necessarily release the memory, as to when the release is determined by the garbage collection algorithm.When an object is not in use, it does not reclaim the possibility of a memory
1. Static collection classes like HashMap, vectors, etc. are most prone to memory leaks, and the lifetime of these static variables is consistent with the application, and all object objects cannot be freed, as they will always be used by vectors and so on.Static vector v = new vector (); for (int i = 1; i In this example, there is a reference to the vector object in the code stack with reference to the V and object o. In the For loop, we constantly
Original address: http://www.javatang.comA period of time on-line after the system upgrade, there is a serious high CPU problem, so began a series of optimization processing, now the process into a series of articles.Basic conceptsWhen analyzing a Java memory leak, you need a dump file that records the memory footprint
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.