Questions about JVM startup exceptions under MyEclipse: Out of Memery/could not reserve enough space for object heap

Source: Internet
Author: User
Tags xms

The following are preliminary understanding: This is mainly the JVM memory configuration problem, the Internet has a lot of reference materials, but we can not rigid rigid sets, must be based on the actual situation of the project to configure the relevant parameters.

1. JVM memory is divided into heap (heap) and non-heap (non-heap) memory according to the JVM's design rules

"Java virtual machines have a heap, which is a run-time data region where all class instances and arrays of memory are allocated." The heap is created when the Java virtual machine is started. "," the memory outside the heap in the JVM is called Non-heap memory (Non-heap memories) ". You can see that the JVM primarily manages two types of memory: heap and non-heap. Simply put, the heap is the Java code of memory that is left to the developer, not the heap is the JVM left to itself, all the method areas used, the JVM internal processing or optimization of the required memory (such as the JIT compiled code cache), each class structure (such as running a constant pool, field and method data) And the code for methods and construction methods are in non-heap memory.

(1) Heap memory allocation
The initial memory allocated by the JVM is specified by-XMS, the default is physical memory 1/64;JVM the maximum allocated memory is specified by-XMX, which defaults to 1/4 of the physical memory. When the default free heap memory is less than 40%, the JVM increases the heap until the maximum limit of-xmx, and when the free heap memory is greater than 70%, the JVM reduces the heap until the minimum limit of-XMS. So the server generally sets-xms,-xmx equal to avoid resizing the heap after each GC.

(2) Non-heap memory allocation
The JVM uses-xx:permsize to set the non-heap memory initial value, which defaults to 1/64 of the physical memory, and the maximum non-heap memory by Xx:maxpermsize, which by default is 1/4 of physical memory.

2, according to the above analysis has learned that the JVM memory contains two kinds: heap memory and non-heap memory, in addition, the maximum JVM memory depends on the actual physical memory and operating system, the sum of-xmx value and-xx:maxpermsize exceeds the maximum limit of JVM memory. For example, the current operating system maximum memory limit, or actual physical memory, and so on. When it comes to physical memory, it is important to note that if your memory is 1024MB, the actual system is not likely to be 1024MB, because a portion of it is consumed by the hardware.

Reference: http://blog.sina.com.cn/s/blog_59d8af510100y6gz.html


I am using Myeclipse10 's own Tomcat6, because it involves importing and exporting database data, so it is often reported out of the Memery or Could not reserve enough space for object heap problem.
A), out of Memery is a memory overflow, usually an error thrown during the program's run, and when we constantly create an instance through new, it is clear that our heap memory is not enough, only to increase the-XMX and-xms at the same time (how much can be added, the following again).
b), Could not the reserve enough space for object heap, can not be instantiated, which is also thrown during the program run error, according to the above, we know that this is the JVM's non-heap memory is not enough to cause, so we need to put XX: The value of the maxpermsize is when it grows.
c), unable to start the virtual machine, usually this is because our memory configuration is unreasonable.

We can enter >java-xmxxxxxm-version at the DOS command line to see the system and the maximum amount of memory that the JDK manages (not bigger, better), XXXX refers to a specific value. Different JDK, manageable memory space size is not the same.


Reference: Http://blog.sina.com.cn/s/blog_56d8ea900100c3tf.html. Open Windows Explorer, we can see the JAVAW run occupied system memory, once greater than the above limit value, will be error, we can modify the program code to solve. (Reduce initialization to memory data, code overall function sub-module implementation, etc.) Note: The sum of-XMX and-XX cannot exceed the maximum value of XXXX. (The larger the-XMX value, the faster the program will definitely run, the actual test) mentioned above MyEclipse itself is the default configuration of-xmx and-xx, in ~\myeclipse 10 under Myeclipse.ini, if you start MyEclipse, report create VM fail error, that is, the two parameters of the file set up a problem, most of the value is too large, more than the default VM management ability range.

Questions about JVM startup exceptions under MyEclipse: Out of Memery/could not reserve enough space for object heap

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.