Out of memory errors are common in especially "heavy" AnyLogic models. For example, simulations that contain many computations can easily exceed memory thresholds, causing a Pathmind experiment to crash.

1. Reproduce the memory issue

Run a 100-iteration Monte Carlo experiment (or a Parameter Variation experiment if you do not have access to Monte Carlo). Reinforcement learning is mechanically similar to a Monte Carlo experiment so this will reveal any issues.

When running the Monte Carlo (or Parameter Variation), toggle the Developer Panel, and take note of memory usage. If memory usage exceeds the maximum simulation memory available (512M in this example) or if the simulation appears sluggish, this usually means something in your simulation is consuming too much memory (e.g. improper use or inefficient code).

2. Identify the problem

To identify the line of code that is consuming the most memory, you must use a Java profiler such as VisualVM. Please watch this YouTube tutorial for guidance: https://www.youtube.com/watch?v=rkBrYAjhaBE.

Once you identify the line of code that is causing issues, you will need to refactor it and run a 100-iteration Monte Carlo again to confirm whether or not memory usage has decreased. You will need to resolve this problem to continue using Pathmind.

Did this answer your question?