## `module::max` -- simultaneously loadable modules

#### Introduction

`module::max``(maxnum)` sets the maximum number of dynamic modules which may reside in the main memory simultaneously.

#### Call(s)

`module::max()`
`module::max(maxnum)`

#### Parameters

`maxnum` | - | maximum number of dynamic modules which simultaneously reside in the main memory: integer less than or equal to 256 and greater than or equal to 1 respectively the number of currently loaded modules

#### Returns

An integer in the range 1..256.

#### Related Functions

`external`, `loadmod`, `module::age`, `module::displace`, `module::new`, `module::stat`

#### Details

- `module::max``()` returns the current maximum number of dynamic module which may reside in the main memory simultaneously.
- `module::max``(maxnum)` sets a new maximum number and returns this value.

#### Example 1

The maximum number of dynamic modules which resides in the main memory simultaneously can be limited. The first command returns the current setting. The second command sets the maximum number to 256.

    >> module::max()

                                        16

    >> module::max(256)

                                        256

#### Background

- `module::max` uses the module function `stdmod::max` to get and set the maximum number of simultaneously loadable modules.
- If the maximum number of simultaneously loadable modules is reached, for any new dynamic module that is to be loaded at least one previously loaded module is displaced from the main memory with respect to the least-recently-used strategy. Thus, the actual number of simultaneously usable modules is not limited.
- Module displacement is transparent to the user. The machine code is reloaded automatically if it is needed later.
- The maximum number of seconds that the machine code of an inactive dynamic module resides in the main memory can be limited with the function `module::age`.
- The function `module::stat` displays information about the dynamic module which are currently loaded in the main memory.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000