Enable EM4J in the Virtual Machine

After you create a VM on ESXi, you enable EM4J in the VM by adding a parameter to the VM's configuration. You can add a second parameter to limit the size of the EM4J balloon, but it is unnecessary. The following table describes the parameters.

Table 2. EM4J VM Configuration Parameters

sched.mem.pshare.guestHintsSyncEnableWhen set to true, EM4J ballooning is enabled and guest ballooning is disabled. When set to false, guest ballooning is enabled and EM4J ballooning is disabled. This parameter is required to enable EM4J.
sched.mem.maxmemctlSets a limit for the total balloon size for the VM, in megabytes. If set to -1, the default, no limit, is set and ESXi determines the balloon size. If set to 0, ballooning is effectively disabled. It is generally unnecessary to set this parameter. The parameter affects both EM4J and VMware Tools balloons. If you set this parameter and later change the VM's configuration, this parameter will not change dynamically with the other changes.

When EM4J ballooning is enabled, the guest balloon is disabled. If you enable EM4J ballooning, but do not run an EM4J-enabled JVM, there will be no ballooning for the VM, which could lead to the ESXi host swapping pages from the VM. This situation is undesirable because it can be expensive to swap the pages back in again. If you shut down a JVM with an EM4J balloon, the ballooned memory remains until it is written over. This means that the risk of swapping occurring after a JVM shutdown is at least initially very low.

The procedure describes how to add the EM4J configuration parameters using the vSphere Client. You can also add the parameters by editing the VM's VMX text file. After you enable EM4J, cloning the VM will duplicate the setup.



  1. Shut down the guest OS and, using vSphere Client, power off the VM, if necessary. It is not possible to edit the configuration parameters while the VM is running.

  2. In the left panel of the vSphere Client, expand the ESXi host so that the VM you want to configure is visible.

  3. Right-click the VM and select Edit Settings... from the pop-up menu.

  4. Click the Options tab.

  5. In the Settings column, under Advanced, select General. See the following figure.

  6. In the Configuration Parameters box on the right, click Configuration Parameters....

  7. Click Add Row and enter the following parameter, as shown in the following figure.

    • Name: sched.mem.pshare.guestHintsSyncEnable

    • Value: true

  8. (Optional) Click Add Row and enter the following parameter.

    • Name: sched.mem.maxmemctl

    • Value: -1 (or enter the maximum number of megabytes to limit the size of the EM4J balloon)

  9. Click OK twice.

  10. Repeat this procedure for each VM that will run an EM4J-enabled Java application.