3. Memory Management#

A request for read or write access to the value segment associated with an object JEVEUX causes, if it is not already there, a loading into memory of the content of the associated value segment. The memory address of an object JEVEUX corresponds to its relative position in table ISZON. First, it is necessary to perform a dynamic allocation, using the JJALLS routine to insert the value segment. When the allocation request fails, the system refuses to allocate a memory area, a release mechanism is triggered, it can cause disk accesses when areas associated with value segments must be written to the file associated with the database. The new value segment is allocated with a tolerance of 8 integers that correspond to the minimum space associated with a value segment (1 integer per descriptor). When the memory space search fails, the application in error is stopped <S>(stopped by the supervisor with saving the concepts created).

A call to the system function LOC through the routine JXLOCS makes it possible to obtain the relative address of the start of the value segment with respect to the table ISZON using the value of the reference position of the start of the memory area obtained in JXALLM and stored in the common/ILOCJE /. It is the use of routine JJALTY that makes it possible to switch to the table Z. and to obtain, depending on the type, the address in relation to the correct reference.

Allocating a value segment associated with a type object whose length is greater than the addressing unit used (for example for the CHARACTER *24 type) does not automatically make it possible to align with table ISZON, it is sometimes necessary to shift by a few words. The value of this offset is stored in the second descriptor preceding the value segment and the effective size of the value segment is adjusted taking into account its associated type.

It then remains to update the descriptors associated with the value segment, this operation is carried out by the routine JJECRS.

Search for available space

The call to routine JEDISP makes it possible to know, at the time of the call, the size of the available memory areas, it performs the search by going through the entire memory segmentation and gradually deposits the size of the free or unloadable areas in a table provided by call argument.

Memory checking

Memory crashes that affect descriptors (state or status) or forward chaining can be detected using routine JXVERI. This routine looks at the descriptors of the value segments in memory one by one. A fatal error message is sent when an anomaly is detected, otherwise the routine remains silent.