[Change] memory leak using jdk6 check (see the preparation of the GC-friendly and does not leak Code)

Memory leak using jdk6 check (see the preparation of the GC-friendly and does not leak code)
(1) jmap-dump: file = heap_file_name pid file will produce a heap_file_name
(2) jhat heap_file_name, and then open the browser http://localhost:7000/ browsing.
Can see which shows are running all the classes and instances, and size. Platform (such as tomcat) to not be included in it.
(3) If that is not enough, you can also add a bin to heap_file_name file suffix, and then let Eclipse MAT to analyze. See here.
Other
jps: with unix on ps similar to the process used to display the local java, you can see a few local running java process, and demonstrate their process ID.
jinfo: the usefulness of relatively simple, is able to output and modify the java run-time process operating parameters. Usage is jinfo-opt pid, such as: View 2788's MaxPerm size can jinfo-flag MaxPermSize 2788.
jstat also useful to illustrate see here

3
SUN JDK that is supported by the typical options and instructions: http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp with lots of options
-XX:-HeapDumpOnOutOfMemoryError From jdk1.4.2 update 12 and java 5 update 7 began to support this option.

4
About jmap
JDK 5 from the start, SUN JDK began offering JMap tool. But the only experimental, and only in the solaris platform there.
Later Jmap be back ported to jdk 1.4.2_09. Because it is experimental, so jmap dump may occur in case of failure.
However, since JDK 6 after, jmap stability and usability have no problems. Please note that each version of the jvm should use their own version of the jmap,
The jhat can be used to analyze the various versions of jmap dump out the file. As jhat for the analysis of more than 1g dump file
We have had numerous success stories in a notebook, its memory requirements may not be that high.
http://space.itpub.net/27378/viewspace-521225

5, J2SE6 jhat used to analyze the memory heap
http://hi.baidu.com/tister/blog/item/e7374482f4341ca70cf4d2e8.html

6, Java out of memory (OutOfMemory), memory analysis tools
http://uglytroll.ycool.com/post.3046111.html

7, JDK in a good tool jmap, jhat
http://wangzaixiang.blogspot.com/2008/10/jdk-jmapjhat.html
http://hi.baidu.com/zeorliu/blog/item/4f38989413601719d21b70d5.html

8, SAP contribution to the eclipse foundation MemoryAnalyzer, originally called the Java Memory Analysis
To analyze a few G's Memory Dump of memory instead?
http://www.eclipse.org/mat/
Unfortunately, or just support jdk1.4.2 update 12 and java 5 update 7 or more

9, in a way which the variable is not cause memory leaks.
Memory leak occurred in the class variables and instance variables (and this instance is cached, such as the single case of mode) in.
I suggest you from HashMap, HashMap $ Entry start look up.
I have looked for a while the memory leak problem, finally solved.
http://www.javaeye.com/topic/233080

10, you encounter is the ideal situation, but sometimes, this method can not find the reason, only to find the point of causing collapse.'s Like,
An HTTP request, there is no set time-out (sorry, the default is no timeout, did not know why SUN to this set),
Then this thread on the card in here, then, this thread in a stack is placed in another thread content
Originally, the content is to idle threads to handle this, but now, this thread is stuck, but with this method you said,
Absolutely can not find the cause of memory leaks because http does not time out, there have been cards.

I have done a fine Ben Banfa more memory allocation: to dump out regularly with pmap command JVM process memory mapping table, and then diff.
http://www.javaeye.com/topic/256701

11, http://calvin.javaeye.com/blog/91903
java garbage collector is not it? How has a leak, ah, Hu I ah? ?
Ah, the ratio of leakage of non-leakage. C / C + + to leak, the object has not arrived, but no recovery of memory, real memory black hole.
The Java leakage is due to various reasons, object to the application have been useless, but it has been held, has been accessible.
Because nothing less than the sum of several aspects:

1). Was a very long life cycle of collections held improper claims to be the first for Java memory leak.
These collection classes De life cycles usually last very long, and is an auxiliary regulatory nature object, the transaction runs a Yewu After that, if not an object Zhu Dong Ye Wu's removal from the case, the set Jiuhui eat Yuelai Yue and more memory can be used WeakReference, such as WeakHashMap, making it the object holding the object reference does not increase the number.
2). Scope not defined, this is very simple, method local variables defined as class variables, class static variable so.
3). Exception did not increase finally () to release some resources, JDBC time is also very common thing.
4). I have deep understanding of other reasons, such as: Swing in the Listener does not explicitly remove; inner class holds an implicit reference to external objects; Finalizers associated object is not caused by empty and so timely.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of [Change] memory leak using jdk6 check (see the preparation of the GC-friendly and does not leak Code)

  • RoR explained

    ROR is Ruby on Rails. Ruby is a well-known has been very good dynamic language It's dynamic language. Simple and easy. Dynamic languages are interpreted, but the performance may make a discount, but not absolute, because the application is complex, th

  • spring myfaces hibernate richfaces

    1.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j

  • Some interview questions java

    The first is the company give you a chance to meet, it is necessary to know to meet from time to equal the interview, and have a lot of companies to see you at the first time will give you a ready point of doing something trivial, these questions, althoug

  • Process migration from tomcat to websphere changes

    Process migration from tomcat to websphere changes Because customers use the web application server software used by different what tomcat5, tomcat6, websphere5.1, websphere6.1, weblogic8, and so on, and the software used inconsistent standards, ibm's

  • JAVA EE JSP_JNDI

    dsfdsa http://lindows.javaeye.com/admin/blogs/213348 Tomcat 6 with the connection pool data source configuration http://www.blogjava.net/ec2008/archive/2008/07/19/216063.html project: test Driver path: D: \ workspace \ test \ WebRoot \ WEB-INF \ lib ...

  • Learn Java flow

    Related Articles: J2EE without EJB Introducing to Spring Framework (English revised edition) J2EE without EJB caused consider Recommend circles: reading space More related recommend Java Learning Path (1), tools, articles First, JDK (Java Development Kit)

  • The EJB3 Persistence

    EJB3 persistence with Hibernate is very similar to the mechanism: Environment: Server: JBOSS5.0 Database: MySQL5.0 1. Set up a data source First of all, in jboss-5.0.0.GA \ server \ default \ deploy, the establishment of a database used to connect the dat

  • myeclipse plugin

    myeclipsePlug-ins? 1.tomcatPlugin(Start tomcat ):http ://www.sysdeo.com/eclipse/tomcatPlugin.html,2.xVersions of eclipse 3 version 2 .1Version doesn't work. 2.Lomboz(Development of jsp program ,jspDynamic prompt, debugging ):http://forge.objectweb.org/pro

  • Servlet brief introduction

    Servlet brief introduction: Servlet is a small application server Are used to complete the B / S architecture, the client requests the response to treatment Platform independence, performance, able to run thread Servlet API for Servlet provides the s ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries