MAT Memory Analyzer Tool plugin installation (illustrated)

Source: Internet
Author: User

@author YHC

Some time ago did a project, Exception in thread "main" Java.lang.OutOfMemoryError:Java heap

This error occurs, so you need to find the reason, so use this tool, installation is more troublesome, posted out and share with you:

First step: Download Eclipse MAT

Download Address: http://www.eclipse.org/mat/downloads.php

The second step: after downloading the compressed package decompression, placed into the MyEclipse \myeclipse 9\dropins directory

after decompression, you will see these files: Correct one of the following typos is not "write" is "down"

The third step: according to the following figure, a,b,c the order of the corresponding file creation

Part fourth: Restart MyEclipse, open window->perferences, you will see this project:


To put it simply, use (console) if it is Tomcat or another server you need to find out how to configure JVM parameters:

Here is a program code that will cause Java.lang.OutOfMemoryError:Java heap space: (Very easy)

Package org.lx.test;

Import java.util.Date;
Import Java.util.HashMap;
Import Java.util.Map;

public class Outofmemorytest {public
	static void Main (string[] args) {
		map<integer,date> map=new hashmap& Lt;integer, date> ();
		for (int i = 0; i < 600000000 i++) {
			map.put (i, New Date ());}
		}
	
	

First, some parameters need to be set before running:


Then on the page of the parameter settings, set the parameters in A,b order: (-xx:+heapdumponoutofmemoryerror) Avoid writing errors can be copy

The program code that runs the error will see the following results:

Then it generates a file java_pid3708.hprof, which is in the root directory of your project (MYECLIPSE10)

So then we'll open this file to analyze how to open the following figure: (Select the file you just generated in the project root java_pid3708.hprof Open)

When you open it, you will see that the following image is OK:



As for the question of how to find, please refer to the following connection:

The following article has been said in great detail:

1. Using Eclipse Memory Analyzer for heap dump file analysis

2. Using Mat for dump file analysis

If you have any questions, please correct me.



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.