How to fix out of memory errors by increasing available memory | Confluence (2023)

Related content

  • No related content found

Still need help?

The Atlassian Community is here for you.

Ask the community

For Atlassian eyes only

This article is Not Validated and cannot be shared with customers.

Platform notice: Server and Data Center only.This article only applies to Atlassian products on the server and data center platforms.

Purpose

Java applications like JIRA, Crowd and Confluence run in a "Java virtual machine" (JVM), instead of directly within an operating system. When started, the Java virtual machine is allocated a certain amount of memory, which it makes available to applications like Confluence. By default, Java virtual machines are allocated 64Mb of memory, no matter how many gigabytes of memory your server may actually have available. 64Mb is inadequate for most Confluence installations, and so this needs to be increased.

Diagnosis

Click here to expand...

Determine type of error message

Look in the atlassian-confluence.log to see which type of OutOfMemory Error you're receiving. There are three common messages:

  1. Heap Space
  2. Perm Gen Space
  3. GC Overhead

This document discusses increasing memory to address PermGen and Heap space errors. Follow the links above to assess root causes for each issue.

For GC Overhead, refer to Confluence Crashes Due to 'java.lang.OutOfMemoryError GC overhead limit exceeded'.

Determine Confluence's usage patterns

In Confluence, go to Confluence Administration > System Information, and look at the memory graph during times of peak usage:
How to fix out of memory errors by increasing available memory | Confluence (1)

This server has been allocated a maximum of 650Mb and a minimum of 256m. You can see the minimum displayed here; if you're trying to see whether your settings are being picked up, this is where to look.

Determine available system memory

On Windows

From the Close Programs Dialogue (Press ctrl-alt-delete), select the Performance tab:
How to fix out of memory errors by increasing available memory | Confluence (2)

The amount marked Available is the amount in kilobytes you have free to allocate to Confluence. On this server we should allocate at most 214Mb.

On Linux

Run

cat /proc/meminfo 

to view the memory usage.

Setting the -Xmx above the available amount on the server runs the risk of OutOfMemoryErrors due to lack of physical memory. If that occurs the system will use swap space, which greatly decreases performance.

Guidance

The default values supplied with Confluence stand-alone are sufficient for most installations. Please refer to Managing Application Server Memory Settings and Server Hardware Requirements Guide for a discussion.

Solution

Step 1: Increase Available Memory

We aren't really able to give a concrete recommendation for the amount of memory to allocate, because that will depend greatly on your server setup, the size of your user base, and their behavior. You will need to find a value that works for you, i.e. no noticeable GC pauses, and no OutOfMemory errors.

For reference, the 3 most common parameters used to change the memory (heap) allocation are:

  • Xms - the minimum size of the heap
  • Xmx - the maximum size of the heap
  • -XX:MaxPermSize - the maximum size of PermGen (this is not used in Java 8 and above)

    In case you need advice regarding how much memory you should use please check this page for some examples of hardware specifications.

If you do decide to increase the memory settings, there are a few general guidelines to follow:

  • Increase Xmx in small increments (eg 512mb at a time), until you no longer experience the OutOfMemory error. This is because increasing the heap beyond the capabilities of your server to adequately Garbage Collect can cause other problems (eg performance/freezing)
  • If your error is java . lang . OutOfMemoryError : PermGen space, increase the -XX:MaxPermSize parameter in 256mb increments until the error stops occurring.

  • If your error does not reference PermGen, there is no need to increase it. In a simplistic explanation, PermGen is used to store classes, and is generally quite static in size, and has been removed in Java 8. More info here.
  • Consider setting Xms and Xmx to the same value, as this can decrease the time GC takes to occur, as it will not attempt to resize the heap down on each collection.

See our Garbage Collection (GC) Tuning Guide for more detailed information.

  • It is possible to set the Xms and Xms values in either a gigabyte or megabyte format.

When setting these values in megabytes, set the value by multiplying the desired memory level by 1024. For example, to set the memory at 2 gigabytes, configure the Xms and Xmx to 2048m (2GB x 1024MB):

-Xms2048m -Xmx2048m

For the same example using gigabytes, simply use the following:

-Xms2g -Xmx2g

How to fix out of memory errors by increasing available memory | Confluence (3) When setting the value in gigabytes, do not use .5 increments as this will cause the JVM to not start properly.

Linux

Click here to expand...

To increase heap or perm gen space memory in Linux installations,

  1. Shutdown Confluence
  2. Edit<confluence-install>/bin/setenv.sh
  3. Find the section
  • CATALINA_OPTS="-Xms1024m -Xmx1024m ${CATALINA_OPTS}"in Confluence 7.12 or above
  • CATALINA_OPTS="-Xms1024m -Xmx1024m -XX:+UseG1GC $CATALINA_OPTS" in Confluence 5.8 or above
  • CATALINA_OPTS="$CATALINA_OPTS -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -XX:+UseG1GC" in Confluence 5.6 or 5.7
  • JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=256m in previous versions
  1. See Diagnosis above and enter the appropriate values. Xmx is maximum, Xms is minimum, and MaxPermSize is PermGen.
  2. Start Confluence

Windows (starting from .bat file)

Click here to expand...

If you start Confluence as a Service on Windows, then you should not use these instructions. Instead, refer to the "Windows Service" section below.

You should only follow these instructions if you are starting Confluence via the batch file. The batch file is not used when Confluence is started as a Service.

To Configure System Properties in Windows Installations When Starting from the .bat File,

  1. Shutdown Confluence
  2. Edit <confluence-install>\bin\setenv.bat
  3. Find the section
    • CATALINA_OPTS=-Xms1024m -Xmx1024m %CATALINA_OPTS% in Confluence 7.12 or above
    • CATALINA_OPTS=-Xms1024m -Xmx1024m -XX:+UseG1GC %CATALINA_OPTS%in Confluence 5.8 or above
    • CATALINA_OPTS=-Xms1024m -Xmx1024m -XX:MaxPermSize=256m -XX:+UseG1GC %CATALINA_OPTS% in Confluence 5.6 or 5.7
    • JAVA_OPTS=-Xms256m -Xmx512m -XX:MaxPermSize=256m in previous versions
  4. See Diagnosis above and enter the appropriate values. Xmx is maximum, Xms is minimum, and MaxPermSize is PermGen.
  5. Start Confluence

Windows Service

Click here to expand...

There are two ways to configure system properties if you Start Confluence Automatically on Windows as a Service - either via command line or in the Windows Registry

Setting Properties for Windows Services via Command Line

Setting Properties for Windows Services via Command Line

  1. Identify the name of the service that Confluence is installed as in Windows ( Control Panel > Administrative Tools > Services ):
    How to fix out of memory errors by increasing available memory | Confluence (4)
    How to fix out of memory errors by increasing available memory | Confluence (5) In the above example, the SERVICENAME is: JIRA030908110721 (this is a JIRA screenshot, but the same applies to Confluence)
  2. Open the command window from Start >> Run >> type in 'cmd' >> Enter
  3. cd to the bin directory of your Confluence instance
  4. Run (for Tomcat 9, change as necessary for earlier versions):

    tomcat9w //ES//<Your_Service_Name>

    .
    How to fix out of memory errors by increasing available memory | Confluence (6) If you are under confluence 5.5, it would be tomcat6w //ES//JIRA030908110721 instead of tomcat8w (this is a JIRA screenshot, but the same applies to Confluence)
    How to fix out of memory errors by increasing available memory | Confluence (7)

  5. Click on the Java tab to see the list of current start-up options:
    How to fix out of memory errors by increasing available memory | Confluence (8)
  6. Set the maximum memory allocation here
  7. Restart the service

Setting Properties for Windows Services via the Windows Registry

In some versions of Windows, there is no option to add Java variables to the service. In these cases, you must add the properties by viewing the option list in the registry.

To Set Properties for Windows Services via the Windows Registry,

  1. Go to Start >> Run, and run "regedit32.exe"
    How to fix out of memory errors by increasing available memory | Confluence (9)
  2. Find the Services entry:
    32-bit: HKEY_LOCAL_MACHINE >> SOFTWARE >> Apache Software Foundation >> Procrun 2.0 >> Confluence
    64-bit: HKEY_LOCAL_MACHINE >> SOFTWARE >> Wow6432Node >> Apache Software Foundation >> Procrun 2.0 >> Confluence
    How to fix out of memory errors by increasing available memory | Confluence (10)
  3. To change existing properties, especially increasing Xmx memory, double-click the appropriate value.
    How to fix out of memory errors by increasing available memory | Confluence (11)
  4. To change additional properties, double-click options. Note: Make sure to add only one argument per line.
    How to fix out of memory errors by increasing available memory | Confluence (12)
  5. Modify the memory allocations here (i.e. -XX:MaxPermSize=512m).

Step 2: Verify Your Settings

To verify what settings are in place, check Viewing System Information. You should see a section called "Java Runtime Arguments".

Look for Xmx (maximum) and Xms (minimum) settings.

Alternatively, on Linux, run

ps -aux | grep java

to see the environment parameters.

Last modified on Jul 19, 2023

Related content

  • No related content found

Powered by Confluence and Scroll Viewport.

FAQs

How to fix out of memory errors by increasing available memory? ›

Increase Xmx in small increments (eg 512mb at a time), until you no longer experience the OutOfMemory error. This is because increasing the heap beyond the capabilities of your server to adequately Garbage Collect can cause other problems (eg performance/freezing)

How do you resolve out of memory problems? ›

OutOfMemoryError: Metaspace error is thrown. To mitigate the issue, you can increase the size of the Metaspace by adding the -XX:MaxMetaspaceSize flag to startup parameters of your Java application. For example, to set the Metaspace region size to 128M, you would add the following parameter: -XX:MaxMetaspaceSize=128m .

How to resolve out of memory error in eclipse? ›

Resolving the problem
  1. Increase the maximum size of the Java heap that Eclipse uses. For example, use a value of 1024 MB.
  2. Increase the permanent generation space that is available to Eclipse. By default, the permanent generation space is set to 256 MB.

How to resolve out of memory error in JMeter? ›

9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure
  1. How do I allocate more memory to JMeter?
  2. Increase the Java Heap Size.
  3. Use Up-to-Date Software.
  4. Run Tests in Non-GUI Mode.
  5. Use Listeners Wisely.
  6. Decide Which Metrics You Need to Store.
  7. Select the Correct Correlation Option.
  8. Use Assertions Sparingly.
Jul 19, 2021

How do I find the root cause of an out of memory error? ›

You can use a heap dump to analyze the heap and identify the objects that are causing the OutOfMemoryError. Use a profiler: A memory profiler is a tool that can be used to analyze the performance of a Java application. It can be used to identify the parts of the code that are causing an OutOfMemoryError.

How do I manually increase virtual memory? ›

Click Start > All Programs > Control Panel > System > Advanced > Performance > Settings > Advanced > Virtual Memory. Click Change. In the Maximum size field, set the value to the recommended value shown at the bottom of the window. In the Initial size (MB) field, enter a value that is half of the maximum size value.

Can you recover from memory problems? ›

Sometimes, the problem can be treated, and cognition improves. Other times, the problem is a brain disorder, such as Alzheimer's disease, which cannot be reversed. Finding the cause of the problems is important for determining the best course of action. Once you know the cause, you can make the right treatment plan.

What is the cause of out of memory? ›

OutOfMemoryError exception. Usually, this error is thrown when there is insufficient space to allocate an object in the Java heap. In this case, The garbage collector cannot make space available to accommodate a new object, and the heap cannot be expanded further.

What happens when Windows runs out of memory? ›

The device may run very slowly, will be unable to install updates and new programs or save any more files, and will likely become unstable or unusable. If your device or computer is displaying memory warnings, or you're concerned, it's fairly straightforward to check the amount of memory being used on it.

How to increase memory available to Eclipse? ›

Since Eclipse is a Java program, you can increase the heap size of Eclipse by using JVM memory options -Xms and -Xmx. There are two ways to provide JVM options to eclipse either updating the Eclipse shortcut or adding -vmargs on eclipse.

How to increase memory for Eclipse? ›

Increase the heap size
  1. Locate the eclipse. ini file in C:\Users\Public\Micro Focus\Enterprise Developer\eclipse and open it in a text editor.
  2. Use the following options in the file to allocate more memory to Eclipse: --launcher.defaultAction openFile -vmargs -Xms512m -Xmx1024m ( or -Xmx3000m) -XX:+UseParallelGC.

How do I automatically fix errors in eclipse? ›

Placing the cursor in the highlighted text and selecting Quick fix from the Edit menu or clicking shortcut Ctrl + 1 .

What is Out of Memory error in VM? ›

An "Out of Memory" error is caused by not enough memory being allocated to the Java Virtual Machine (VM), and can be resolved by increasing the maximum memory allocated. The –Xms (-ms) value specifies the minimum amount of memory that is used by the Java VM.

What is the Out of Memory crash error? ›

Common Causes for the “Out of Memory” Error

Insufficient RAM: If your machine doesn't have enough RAM left to process any application you want to run, any program you want to execute, or any file you want to access, then the system slaps you with the “out of memory” error.

How to catch Out of Memory error in JavaScript? ›

Increase memory allocation: If the problem is due to insufficient memory allocation, you can increase the amount of memory that is available to the program by using the “ — max-old-space-size” command line flag when starting the Node. js process.

Can memory loss go away? ›

Memory loss is unusual forgetfulness. You may not be able to remember new events, recall one or more memories of the past, or both. The memory loss may be for a short time and then resolve (transient). Or, it may not go away, and, depending on the cause, it can get worse over time.

How do I fix out of memory error in Chrome? ›

How to Repair the Chrome Error Code Out of Memory?
  1. Method 1: Restart Your PC.
  2. Method 2: Check Your Internet Connection.
  3. Method 3: Try Incognito Mode.
  4. Method 4: Update to the 64-bit Version of Chrome.
  5. Method 5: Clear Your Cache and Cookies.
  6. Method 6: Clean Temp Files.
Jul 15, 2023

References

Top Articles
Latest Posts
Article information

Author: Frankie Dare

Last Updated: 21/12/2023

Views: 6466

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Frankie Dare

Birthday: 2000-01-27

Address: Suite 313 45115 Caridad Freeway, Port Barabaraville, MS 66713

Phone: +3769542039359

Job: Sales Manager

Hobby: Baton twirling, Stand-up comedy, Leather crafting, Rugby, tabletop games, Jigsaw puzzles, Air sports

Introduction: My name is Frankie Dare, I am a funny, beautiful, proud, fair, pleasant, cheerful, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.