Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

Categories

How can I prevent 'Out of Memory' errors in yEd?

+3 votes
in Help by (3.4k points)

1 Answer

+4 votes
 
Best answer

The following advice applies to yEd version 3.16 and before.
As of yEd version 3.16.1, the maximum heap space of the Java virtual machines that come bundled with yEd installers is not restricted anymore.


You can prevent 'Out of Memory' errors by extending the Java heap space for yEd.

yEd is a Java application and, as such, constrained by the Java Virtual Machine (JVM) it runs in. The JVM imposes a limit to the amount of memory that an application can use.

Even if your computer has more memory, yEd cannot use it, i.e., if yEd needs more memory than its limit, an OutOfMemoryError occurs with a message like "java heap space out of memory".

By default, the maximum amount of memory available to yEd is set to 512 MB (beginning with version 3.7.0.1; prior versions used 256 MB). This limit can be set to a different value at the startup of a Java application.

To increase this limit for yEd, do the following:

  • If you used the yEd Installer for Windows, you can add a parameter to the link on the desktop.
    1. Right click on the yEd icon on the desktop to open the context menu and select the entry 'Properties'.
    2. In the field 'Target', add -J-Xmx768m to set the limit to 768 MB. Of course, you can use other values, too.
      For example, the field's content should be similar to
      "C:\Program Files\yWorks\yEd\yEd.exe" -J-Xmx768m
    3. Click 'OK' to close the dialog. If you subsequently start yEd by double clicking the link on the desktop, it will use up to 768 MB of memory.
  • On Windows, you can also use this attached batch script to start yEd with custom parameters for Java's memory limit. Please have a look at the comments in the batch file which describe how to use it.
  • If you used the yEd Installer for Mac OS X, you can adjust the Info.plist file in the yEd.app directory:
    For the VMOptions key, use as the new value -Xmx768m instead of the original value.
    As of yEd 3.13, additional options have to be placed in section [JVMOptions] of file yEd.app/Contents/Java/yEd.cfg.
    As of yEd 3.19.1.1, additional options have to be placed in section [JavaOptions] of file yEd.app/Contents/app/yEd.cfg.
    As of yEd 3.21, entries in section [JavaOptions] of file yEd.app/Contents/app/yEd.cfg have to be prefixed with java-options=, e.g.
    java-options=-Xmx768m
  • On Linux, open the yEd shell script, which is located in the yEd installation directory, in a text editor. Go to the second to last line and find "-Xmx512m". Change 512 to a higher value.
  • On any operating system with an installed Java Runtime Environment (JRE) you can also directly run yEd from the command line and set the heap space limit as follows.
    1. Open a command prompt.
    2. Go to the directory where yEd is installed.
    3. Type java -Xmx768m -jar yed.jar and hit the return key.

Warning

Specifying too much heap space may prevent yEd from starting. In this case an error message "The JVM could not be started. The main method may have thrown an exception." may be shown.

by [yWorks] (23.7k points)
edited by
Thank you, Thomas! This answer save a lot of my works!
Thank so much Thomas ! It is very usefull and efficient way to keep and save a lots of big model like the previous said !!!
Não consegui fazer. O meu sistema é o Windows.
Onde se encontra o "Target"?

Right-clicking the yEd desktop shortcut as described in step 1, the following dialog will be opened:

The "target" is the highlighted field.

For macOS, the VMOptions key is no longer in Info.plist. However, adding the following to Contents/Java/yEd.cfg appears to work:

[JVMOptions]
-Xdock:name=yEd
-Xmx2g
Legal Disclosure | Privacy Policy
...