## `module::age` -- module aging

#### Introduction

`module::age``(maxtime)` sets the maximum number of seconds that the machine code of an inactive dynamic module resides in the main memory. A module is called inactive, if its machine code is currently not executed or used in any other sense.

#### Call(s)

`module::age()`
`module::age(maxtime)`
`module::age(maxtime,interval)`

#### Parameters

`maxtime` | - | maximum number of seconds before module displacement takes place: integer of range 0..3600
`interval` | - | maximum number of seconds between two checks for module displacement: integer of range 1..60

#### Returns

An integer of range 0..3600 is returned.

#### Related Functions

`module::displace`, `module::max`, `module::new`, `module::stat`

#### Details

- Module aging is an automatical displacement strategie for the machine code of currently loaded modules. It prevents the MuPAD kernel from linking too much unused machine code and frees memory resources.
- `module::age``()` returns the current maximum age of dynamic modules. This is the maximum number of seconds the machine code of a dynamic module resides in MuPAD kernel process before it is displaced from the main memory. The return value 0 indicates that module aging is deactivated.
- `module::age``(maxtime)` sets a new maximum age of dynamic modules and returns this value.
- `module::age``(0)` deactivates the module aging. This is the default value.
- `module::age``(maxtime,interval)` also sets the maximum number of seconds between two successive checks whether any inactive dynamic module has to be displaced.

#### Example 1

The time that the machine code of inactive dynamic modules reside in main memory can be limited. The first command returns the current aging time and the second command sets it to 30 seconds. The third command sets the aging time to 60 seconds specifying that the modules are checked every 10 seconds.

    >> module::age()

                                         0

    >> module::age(30)

                                        30

    >> module::age(60,10)

                                        60

#### Background

- `module::age` uses the module function `stdmod::age` to get and set the maximum age.
- This kind of module resource management is called module aging.
- The Aging algorithm is called periodically during the evaluation as well as directly before the functions `loadmod`, `unloadmod` and `external` are executed.
- Beside module aging, the maximum number of modules which simultaneoulsy reside in main memory can be limited with the function `module::max`.
- 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