Modifying Max Heap for JVM on Niagara Supervisor in N4

In versions 4.0, 4.1, and 4.2 of the Niagara 4 Windows Supervisor installation, the default maximum heap size setting for station is 256M, which corresponds to 256 MB.  In some cases, this number is too small and the java.lang.OutOfMemoryError exception is thrown when there is insufficient space to allocate an object in the Java heap. 
 

 
This Tech Tip describes how to modify the maximum heap size to a number that fits your Supervisor.  
  1. Use the right-click option to open Workbench using the Run as administrator option.  This gives Workbench the permissions that are required to modify the nre.properties file.  See Figure 1.  
Figure 1: Open Workbench as Administrator:
  1. Connect to the local platform and and view the Platform Administration page.  See Figure 2.
Figure 2: Platform Administration:
  1. Note the location of "User Home" for the Niagara Daemon.  See Figure 2.
  2. In the Nav Sidebar, find the etc/nre.properties file under the Niagara Daemon's User Home noted in the previous step.  See Figure 2
  3. Use the right-click option to open the nre.properties file in Text Editor, or AX Text Editor.  See Figure 3.
Figure 3: Views on nre.properties File:
  1. On the line for station.java.options, where you see "-Xmx256M", modify it to a custom value (see figure 8).  Oracle recommends that you set it to either 1/4th of the physical memory, or 1GB - whichever is smaller (https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gc-ergonomics.html).  But you may have valid reasons to use some other value.  See Figure 4.
Figure 4: nre.properties in AX Text Editor:
  1. Save the file.  See Figure 4
  2. Restart the Supervisor station.  See Figure 5
Figure 5: Application Director:
  1. Verify the new heap.max on the Resource Monitor for the station.  See Figure 6
Figure 6: Resource Monitor:


Important Notes on Version Differences:
  • 4.0: the station runs with the settings in %niagara_home%/defaults/nre.properties
  • 4.1: the station runs with the settings in %niagara_USER_home%/etc/nre.properties
  • 4.2: the station runs with the settings in %niagara_USER_home%/etc/nre.properties. If the file does not exist, it copies the one in %niagara_home%/defaults/nre.properties when the station is started (if it exists)
  • If nre.properties does not exist as described above, maximum heap is not defined and the JVM decides on the value for heap.max


 
 

Add Feedback