This page will look better in a graphical browser that supports web standards, but is accessible to any browser or internet device.

-->

JSim Memory Usage

Introduction

JSim allows users to create arbitrarily large models, which can tax a computer's memory and cause various problems. This document provides information about how to deal with these problems.

Prerequisites:

Contents:

Overview

Writers of large JSim models may need to be aware of system memory limitations. Real data in JSim models occupy 8 bytes per grid point, thus a model with 3 variables u(t), v(t), w(t) where t has 1000 grid points will occupy 3 x 8 x 100 = 24KB of storage. Variables with multiple dimensions quickly eat up memory. A variable u(x,t), where x and t both have 1000 grid points will occupy 8 x 1000 x 1000 = 8MB. Model runs with multiple inner and outer loops cause storage requirements to grow with the number of model runs.

Running a JSim model when insufficient memory is available will result in various failures. Often failures will occur during a model run, or when attempting to display large amounts of tabular data text. In these common cases, JSim should give a coherent error message, allowing you to save your work and restart JSim with more memory. However, memory overflow in a severely taxed system may occur in any part of the program, causing inexplicable crashes and/or freezes, so if you have reason to believe you are bumping your head on the memory ceiling, it is a good idea to restart with more memory to give JSim ample work space.

JSim runs inside the Java Virtual Machine(JVM), which defines at startup the maximum amount of memory that may be used. JSim, by default, starts the JVM with a maximum of 300MB which is sufficient for most moderate size models. Memory is dynamically assigned, so having a large maximum will not necessarily monopolize system resources. However, if the memory assigned exceeds the system's physical memory, thus requiring paging to virtual memory, JSim performance can sag noticably. Also, placing an unrealistically large limit can allow renegade models to monopolize system resources. In severe cases, this can crash or freeze your operating system. Therefore, you should be cautious changing JSim's memory allocation.

Information for Linux Systems

JSim memory usage is controlled by the JSIMMEM environment variable, which represents the maximum number of megabytes of memory allowed. The default value is 300. A value if 0 disables the memory ceiling, and is highly dangerous to your system, so is not recommended. Here is an example for the C-shell doubling JSim's default memory allocation:

      setenv JSIMMEM 600
      jsim

Further information on Unix environment variables .

Information for Windows Systems

JSim memory usage is set by JSIMMEM variable inside your jsim.bat or jsbatch.bat executables. These files are located in the win32\bin directory in your JSim installation directory. If you are not sure where JSim is installed on your system, consult your system administrator. You may edit these batch files by changing the following line, as is appropriate:

      set JSIMMEM=300

Future Plans

Models with very large memory requirements may exceed the capacity of even a fairly substantial computer. To address this problem, the JSim team is developing a model data journaling system that allows some model variables to be stored on disk, rather than in memory, and recalled as needed. The resulting speed loss may or may not be noticable, depending on model complexity, processor speed and disk speed. Generally, large models will also be complex, requiring longer computation times. To minize speed degradation, journaling operates concurrently with model calculations, so most large models will not be significantly slowed by journaling.

[This page was last modified 03Mar08, 3:11 pm.]

Model development and archiving support at physiome.org provided by the following grants: NIH/NHLBI T15 HL88516-01 Modeling for Heart, Lung and Blood: From Cell to Organ, 4/1/07-3/31/11; NSF BES-0506477 Adaptive Multi-Scale Model Simulation, 8/15/05-7/31/08; NIH/NHLBI R01 HL073598 Core 3: 3D Imaging and Computer Modeling of the Respiratory Tract, 9/1/04-8/31/09; as well as prior support from NIH/NCRR P41 RR01243 Simulation Resource in Circulatory Mass Transport and Exchange, 12/1/1980-11/30/01 and NIH/NIBIB R01 EB001973 JSim: A Simulation Analysis Platform, 3/1/02-2/28/07.