@Java VISUALVM Analysis Heap dump file

Source: Internet
Author: User
Tags visualvm

Test program

 Public classHeapoom {Private Static inti = 0; Static classOomobject {} Public Static voidMain (string[] args) {List<OOMObject> list =NewArraylist<oomobject>(); Try {             while(true) {List.add (Newoomobject ()); I++; }        } finally {            //810325System.out.println (i); }    }}

Output:

[GC (Allocation Failure) 5142k->3031k (19968K), 0.0070246secs] [GC (Allocation Failure) 8663K->7062k (19968K), 0.0066110secs] [GC (Allocation Failure) 12694K->12708k (19968K), 0.0091115secs] [Full GC (ergonomics) 12708K->10719k (19968K), 0.1400352secs] [Full GC (ergonomics) 16351K->14231k (19968K), 0.1051886secs] [Full GC (ergonomics) 16799K->16622k (19968K), 0.1139390secs] [Full GC (Allocation Failure) 16622K-&GT;16593K (19968K), 0.1047700Secs]java.lang.outofmemoryerror:java heap spacedumping heap to java_pid11700.hprof ... Heap dump file created [28412377 bytes in 0.082secs]810325Exception in Thread"Main"Java.lang.OutOfMemoryError:Java Heap space at Java.util.Arrays.copyOf (Arrays.java:3210) at Java.util.Arrays.copyOf (Arrays.java:3181) at Java.util.ArrayList.grow (Arraylist.java:261) at Java.util.ArrayList.ensureExplicitCapacity (Arraylist.java:235) at Java.util.ArrayList.ensureCapacityInternal (Arraylist.java:227) at Java.util.ArrayList.add (Arraylist.java:458) at Heapoom.main (Heapoom.java:17) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java:62) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:498) at Com.intellij.rt.execution.application.AppMain.main (Appmain.java:144)

View heap dump files using Java VISUALVM java_pid11700.hprof

You can see that the Oomobject class has 810,326 instances, causing memory overflow oom.

@Java VISUALVM Analysis Heap dump file

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.