JVM Memory settings in eclipse

Source: Internet
Author: User
Tags ini xms

Eclipse.ini Memory settings

-vmargs-xms128m-xmx512m-xx:permsize=64m-xx:maxpermsize=128m

Here are a few questions:

1. What are the meanings of each parameter?

2. Why do some machines I have-xmx and-xx:maxpermsize set to 512M after eclipse can start, and some machines will not start?

3. Why are the above parameters written to the Eclipse.ini file eclipse does not perform the corresponding settings?

Let's answer each of these.

1. What are the meanings of each parameter?

Parameter-vmargs means set JVM parameters, so the following are actually parameters of the JVM, we first look at the JVM memory management mechanism, and then explain the meaning of each parameter represents.

Heap (HEAP) and non-heap (non-heap) memory

According to the official statement: "Java virtual machines have a heap, the heap is the Run-time data region, all class instances and arrays of memory are allocated from here." The heap was created when the Java virtual machine was started. "" Memory outside the heap in the JVM is called Non heap memory (non-heap memory). You can see that the JVM mainly manages two types of memory: the heap and the non heap. Simply put, the heap is the memory that Java code can have, is reserved for developers, and not heaps are for the JVM to use, so the method area, JVM internal processing or tuning required memory (such as JIT-compiled code caching), 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.

Heap memory allocation

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

Non-heap memory allocation

The JVM uses-xx:permsize to set a non heap memory initial value, which defaults to 1/64 of physical memory, and the maximum amount of non heap memory is set by Xx:maxpermsize, which defaults to 1/4 of physical memory.

JVM memory limit (maximum)

First, JVM memory is limited to the actual maximum physical memory (nonsense!) Well, assuming that the physical memory is infinite, the maximum value of JVM memory is related to the operating system. To put it simply, the 32-bit processor, while the controllable memory space has 4GB, will give a limit to the specific operating system This limitation is generally 2GB-3GB (generally the Windows system under the 1.5g-2g,linux system is 2g-3g), and more than 64bit of processors will not be limited.

2. Why do some machines I have-xmx and-xx:maxpermsize set to 512M after eclipse can start, and some machines will not start?

With the above introduction to JVM memory management, we have learned that JVM memory consists of two types: heap memory and non heap memory, and that the JVM's maximum memory depends first on the actual physical memory and operating system. So setting the VM parameters causes the program not to start mainly for the following reasons:

1 The value of-XMS in the parameter is greater than-XMX, or the value of-xx:permsize is greater than-xx:maxpermsize;

2-xmx values and-xx:maxpermsize totals exceed the maximum JVM memory limits, such as the current operating system maximum memory limit, or actual physical memory, and so on. When it comes to actual physical memory, the point is, if your memory is 1024MB, it's not possible to use 1024MB in the actual system, because some of it is consumed by the hardware.

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.