How to increase memory for Cytoscape
from Notes on memory consumption, Cytoscape User Manual
For users interested in loading large networks, the amount of memory needed by Cytoscape will increase. Memory usage depends on both number of network objects (nodes+edges) and the number of attributes. Here are some rough suggestions for memory allocation:
Suggested Memory Size Without View
Number of Objects (nodes + edges) |
Suggested Memory Size |
0 - 70,000 |
512M (default) |
70,000 - 150,000 |
800M |
Suggested Memory Size With View
Number of Objects (nodes + edges) |
Suggested Memory Size |
0 - 20,000 |
512M (default) |
20,000 - 70,000 |
800M |
70,000 - 150,000 |
1G |
Changing memory allocations on Windows, Mac, and Linux machines
There are a number of ways to change Cytoscape's memory allocation, depending on your preferred method of opening the application. All of them will change Cytoscape's default memory parameters except starting from the command line.
Option A: Command line startup (All operating systems/platforms)
Create a Cytoscape.vmoptions file in the .cytoscape directory. Make sure to add exactly one JVM option per line and that the last line has a line break at the end. The most popular and important option is "-Xmx" followed immediately (no spaces!) by the amount of heap memory. You can add an "M" for megabytes or a "G" for gigabytes. Other options you may use may depend on the particular JVM that you are running. A typical Cytoscape.vmoptions file would look like this:
-Xmx5G -Xss10M
This file allocates a maximum of 5GiB of heap memory and 10MiB of stack space per thread.
Option B: Using the Cytoscape icon (Windows and/or Linux systems)
Just like with Option A, you can use the Cytoscape.vmoptions file. The problem with Windows is that the lines need to be terminated with a single line feed character (a.k.a. a "newline" character) and must not contain any carriage return characters. This is difficult to accomplish on Windows on which the default is line termination with carriage-return/line-feed pairs. You typically need to use a programmers editor and make sure to set the line-end configuration to line-feeds only! Another option on Windows is to create the Cytoscape.vmoptions file on Mac OS or Linux and then to copy it into the Windows installation directory. N.B.: this is not a problem on Linux! (If you have a 64-bit version of Windows and are running a 64-bit version of Java, you can also try using this Cytoscape.vmoptions file.)
Option C: Using the Cytoscape icon on Mac OS
- In the Finder, right-click on the Cytoscape icon and select Show Package Contents.
Go to the Contents folder and open the file info.plist.
In the Property List Editor, expand the Root directory, then Java, and modify the VMOptions value as per Option A. You may put multiple options separated by spaces here. You probably have to right-click the "VMOptions" entry and select "Value type -> Array", then click on the triangle in front of the "VMOptions" entry so that it points downward and on the icon at the end of the "VMOptions" to create a new item. Add a single JVM option for each item, e.g. "-Xms20M" for "Item 0" and "-Xmx2G" for "Item 1".
- Save and close the file.
- Open Cytoscape by double-clicking on the icon.