Allocating Memory
COMSOL Multiphysics stores the data in Java®. If you are experiencing memory problems during meshing, postprocessing operations, or when exchanging data between the COMSOL server and MATLAB®, this can mean that the Java heap size is set with too low a value.
Either set The COMSOL Multiphysics Server Java Heap Size or Setting Manually the Memory in MATLAB.
The COMSOL Multiphysics Server Java Heap Size
The Java heap size settings for the COMSOL Multiphysics server process are stored in the comsolmphserver.ini file. You can find this file in the COMSOL64/Multiphysics/bin/<arch> directory. <arch> correspond to the architecture of the machine where the COMSOL Multiphysics server is running (win64, maci64, macarm64, or glnxa64).
Edit the file with a text editor. The Java heap settings are defined as in the following lines:
-Xss4m
-Xms40m
-Xmx1024m
-XX:MaxPermSize=256m
The values are given in Mega bytes (Mb). Modify these value to satisfy the model requirements.
Setting Manually the Memory in MATLAB
Matlab uses its own memory space for handling the data that are transferred between Matlab and Comsol as well as its own variables.
In order to modify the Java heap space for the Matlab program you do this by opening Matlab. Open the Settings window. Navigate to MATLAB->General->Java Runtime Environment. Update the Java Heap Size according to the requirements of the model and shut down Matlab. The next time Matlab is started the new values will be used.