Wolfram Computation Meets Knowledge

How do I increase the Java heap space?

Increasing the Java heap space allows J/Link to use more memory. This helps J/Link when it requires more memory than it can normally access. To increase the Java heap space in Mathematica, restart the Java Virtual Machine with a special argument.

Open Mathematica and run:

<<JLink`;
InstallJava[];
ReinstallJava[JVMArguments -> "-Xmx512m"]

Here, “512m” stands for 512 megabytes, or 0.5GB. To further increase the Java Heap Space, use, for example, “1024m” for 1GB.

Whenever you restart Mathematica or start a new kernel, this code needs to be evaluated for J/Link to have access to the additional heap space.

To have the code automatically evaluate when you start Mathematica, place the code in Mathematica’s init.m file.

Is this article helpful?
Yes
No

Any comments?

Thank you for your feedback.

Submit

Contact Support

Whether you have a question about billing, activation or something more technical, we are ready to help you.

1-800-WOLFRAM (+1-217-398-0700 for international callers)

Customer Support

Monday–Friday
8am–5pm US Central Time

  • Product registration or activation
  • Pre-sales information and ordering
  • Help with installation and first launch

Advanced Technical Support (for eligible customers)

Monday–Thursday
8am–7pm US Central Time

Friday
8:30–10am & 11am–5pm US Central Time

  • Priority technical support
  • Product assistance from Wolfram experts
  • Help with Wolfram Language programming
  • Advanced installation support