Find the damn outofmemoryerror.

Source: Internet
Author: User
Tags arrays


Seeing this pile of information, I think you should know what to do.

Main at
  java.lang.outofmemoryerror.<init> () V (outofmemoryerror.java:48)
  at Java.util.Arrays.copyOfRange ([CII) [C (arrays.java:2694) at
  java.lang.string.<init> ([CII) V (String.java : 203) at
  java.lang.StringBuilder.toString () ljava/lang/string; (stringbuilder.java:405)
  At Com.mkk.utils.GuidGeneratorTest.outOfMemory () V (guidgeneratortest.java:25) at
  Sun.reflect.NativeMethodAccessorImpl.invoke0 (Ljava/lang/reflect/method; Ljava/lang/object; [Ljava/lang/object;) Ljava/lang/object; (Native method)
  At Sun.reflect.NativeMethodAccessorImpl.invoke (ljava/lang/object;[ Ljava/lang/object;) Ljava/lang/object; (nativemethodaccessorimpl.java:57)
  At Sun.reflect.DelegatingMethodAccessorImpl.invoke (ljava/lang/object;[ Ljava/lang/object;) Ljava/lang/object; (delegatingmethodaccessorimpl.java:43)
  At Java.lang.reflect.Method.invoke (ljava/lang/object;[ Ljava/lang/object;) Ljava/lang/object; (method.java:601)

Increased memory, increased memory, memory overflow, so I set the

java_opts=-server-xms2048m-xmx2048m-xx:permsize=1024m-xx:maxpermsize=512m-xss512k

Reboot the server, not too long and outofmemoryerror

It's time to know the damn outofmemoryerror,

So, please add to java_opts

 -xx:+heapdumponoutofmemoryerror-xx:heapdumppath=/home/error

(Note: The red section is a path to the server, and when OutOfMemoryError is the JVM information is stored in the directory)

Restart the server again, look forward to the next OutOfMemoryError bar.

Yes, OutOfMemoryError again ...

Now, let's go to the/home/error catalogue. Is there a file generation similar to Java_pid6472.hprof, still large (good dozens of or hundreds of MB).

Now, it is recommended to download the mat (Memory Analyzer Tool) tool to see what stuff is running out of memory (and the Jvisualvm.exe tools that are available with JDK). Download Address:

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

Finally, find the source. To modify the code.

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.