This function requires Analytica Enterprise or better.


Returns the number of bytes of memory in use to store the mid and prob values of «variable». For example, to estimate the amount of memory used to store results for Variable Revenue:


This result may be approximate for the reasons discussed below.

Shared Sub-Arrays

A variable may share subarrays with other variables. Hence,

MemoryInUseBy(X) + MemoryInUseBy(Y)

may overestimate the total memory used, if X and Y share subarrays that get counted in the result for both X and Y.

Subarrays may also be shared within the same array, and in some cases multiple times. Analytica uses this feature as a form of sparse-array representation, which may result in a dramatic reduction in memory used relative to a full dense array with the same number of cells. Similarly, when arrays contain identical text values -- e.g. "Hello World" -- in multiple cells, it often stores the text value only once in memory -- especially if the text originates from the same point in the model. MemoryInUseBy(X) (since 4.3) takes these memory optimizations into account.

Internal Heap Overhead

Memory allocations involve a certain amount of "heap overhead" -- space used by the underlying execution system to support dynamic memory allocation, not estimated by MemoryInUseBy. This overhead includes memory used by the Windows operating system, the run-time system, and Analytica's own memory management. For example, if Analytica needs a block of 120 bytes, the memory management system may reserve 128 bytes (hypothetically) to obtain various efficiencies, plus another 32 bytes of bookkeeping to keep track of what has been allocated. Heaps are also subject to fragmentation, in which small blocks of unused memory may exist between active allocations. The exact numbers for these types of overhead are hard to predict exactly.

Local Index Space

The space used by local indexes is generally not tallied. If you ask for the space used by array A, which happens to be indexed by a local index A.I, the object .I and its value consumes space which is not tallied. That same space will be shared between all arrays that use that local index.

Optimization Storage

Memory used internally by «LP», «QP» or «NLP» objects is only partially counted (because Analytica has no way of knowing exactly how much memory is being consumed internally by the Frontline Solver).

Intermediate Values during Evaluation

The result returned from MemoryInUseBy reflects the amount of memory used by the mid, prob and index values at the time it is called. When a result is computed, intermediate values may require more space than the final result alone, and in some cases when these intermediates have extra dimensions, this can be dramatically more space. The space temporarily utilized during computation is not measured by this function, and there is currently no method for accessing the maximum amount of memory consumed during a computation from within Analytica.

See Also


You are not allowed to post comments.