Eclipse memories Analyzer, memory leak plugin, install using dragon

Source: Internet
Author: User

There are many online documents, but there are problems at first. Organize a copy as a backup. Use procedure: After the development code has written, to the potential memory overflow code, add the configuration file, generate. hprof file, with Memory Analyzer analysis to troubleshoot problems, and leakage memory size can be configured. The specific installation test train is as follows:

1. Installation:

help-"Install new software-" work with: here to fill out the Eclipse version: Kepler-http://download.eclipse.org/releases/kepler (note that the different versions here may Different address!!! )--"General Purpose tools--" find "Memory Analyzer" and "Memory Analyzer (Charts)", and select. Restart Eclipse When you are finished installing.

2. Modify the configuration in advance: Note: Because the subsequent analysis process requires a lot of memory, so after opening the parsed file, may be reported memory overflow, need to adjust the Eclipse memory , note: Many online is deceptive, Eclipse.ini must be found in the Eclipse directory at the end:-xms2048m-xmx2048m so that you want to see Eclipse running memory dynamically:

3. Writing Memory leak test code

A large number of strings are roughly added to the ArrayList loop. This will definitely overflow for 20M memory settings.

1 @Test2      Public voidtestoutofmemory () {3list<string> list =NewArraylist<string>();4          for(inti=0;i<10000000;i++){5String str =NewString ();6 List.add (str);7         }8}

4. Run parameter configuration: Run As-->run CONFIGURATIONS-->ARGUMENTS-->VM Arguments:-xms20m-xmx20m-xx:+heapdumponoutofmemoryerror, Configuration 20M as memory overflow limit, easy to test, the specific size of everyone can control their own. After the-xx:+heapdumponoutofmemoryerror is configured, files are generated when the overflow is saved. For example:, after the test code is run, the console output, see:.

5. After the code runs, the refresh project under Eclipse is visible, the Hprof file is generated, and the double-click Opens (Note that this is the reason for setting the parameter in the second step). By default, the first item is selected and finish is ready. , the specific analysis:, visible, is the main thread of the ArrayList memory overflow.

Eclipse memories Analyzer, memory leak plugin, install using dragon

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.