Check available memory

If you are running out of memory, you will see the following error message:

java.lang.OutOfMemoryError

When you are running out of memory, either the Replication Agent drops out of Replicating state or the entire Replication Agent server stops executing.

To support adjusting the amount of memory available to the JRE, all of the executable scripts (or batch files) in the Replication Agent bin directory refer to an environment variable named RA_JAVA_MAX_MEM. All Replication Agent instance RUN scripts also reference the RA_JAVA_MAX_MEM environment variable.

Default heap size

Replication Agent 15.2 does not set the RA_JAVA_MAX_MEM environment variable in the executable or RUN scripts, enabling the JVM to use the default maximum heap size. In Java 6, the default maximum heap size is the smaller of the following two values:

See the Java 6 documentation for information about the default initial and maximum heap sizes and for recommendations on how to set the defaults.

Setting the default maximum memory

The default maximum memory can be set in three ways:

The setting of RA_JAVA_MAX_MEM in the RUN script file overrides the setting of the RA_JAVA_MAX_MEM environment variable and the setting of RA_JAVA_MAX_MEM in the ra script file. If RA_JAVA_MAX_MEM is not set in the RUN script file, the setting of the RA_JAVA_MAX_MEM environment variable overrides any value set for RA_JAVA_MAX_MEM in the ra script file. The setting for RA_JAVA_MAX_MEM in the ra script file is used only if RA_JAVA_MAX_MEM is set neither in the RUN script file nor in the RA_JAVA_MAX_MEM environment variable.

You can override the JVM default for the maximum amount of memory available to the JRE for all instances of Replication Agent or for one specific instance of Replication Agent.

StepsOverriding the default for all instances

  1. Open the ra script file for editing.

    • For Windows, edit the %SYBASE%\RAX-15_2\bin\ra.bat file.

    • For UNIX, edit the $SYBASE/RAX-15_2/bin/ra.sh file.

  2. Uncomment lines in the ra script file.

    • For Windows, uncomment the following line:

      set RA_JAVA_MAX_MEM=512m
      
    • For UNIX, uncomment the following lines:

      RA_JAVA_MAX_MEM=512m
      
      export RA_JAVA_MAX_MEM
      
  3. If necessary, replace “512m” with a value appropriate for your replication environment.

  4. Save the ra script file.

StepsOverriding the default for one instance

  1. Open the RUN script file for editing.

    • For Windows, edit the %SYBASE%\RAX-15_2\<instance>\RUN_<instance>.bat file.

    • For UNIX, edit the $SYBASE/RAX-15_2/<instance>/RUN_<instance>.sh file.

    Here, <instance> is the name of the Replication Agent instance.

  2. Uncomment lines in the RUN script file.

    • For Windows, uncomment the following line:

      set RA_JAVA_MAX_MEM=512m
      
    • For UNIX, uncomment the following lines:

      RA_JAVA_MAX_MEM=512m
      
      export RA_JAVA_MAX_MEM
      

      NoteIn the UNIX RUN file, spaces are not allowed on either side of the = sign.

  3. If necessary, replace “512m” with a value appropriate for your replication environment.

  4. Save the RUN script file.