_heaplen
Holds the length of the near heap.
Defined in header <dos.h>
Syntax
extern unsigned Jieaplen;
Remarks
Jieaplen specifies the size (in bytes) of the near heap in the small data n\odels (tiny, small, and medium). Jieaplen does not exist in the large data models (compact, large, and huge), as they do not have a near heap.
In the small and medium models, the data segment size is computed as follows:
data segment [small,medium] = global data + heap + stack
where the size of the stack can be adjusted with _stklen.
If Jieaplen is set to 0, the program allocates 64K bytes for the data segment, and the effective heap size is
64K - (global data + stack) bytes
By default, Jieaplen equals 0, so you'll get a 64K data segment unless you specify a particular Jieaplen value.
In the tiny model, everything (including code) is in the same segment, so the data segment computations are adjusted to include the code plus 256 bytes for the program segment prefix (PSP).
data segment[tiny] = 256 + code + global data + heap + stack If Jieaplen equals 0 in the tiny model, the effective heap size is obtained by subtracting the PSP, code, global data, and stack from 64K.
In the compact and large models, there is no near heap, and the stack is in its own segment, so the data segment is simply
data segment [compact,large] = global data
In the huge model, the stack is a separate segment, and each module has its own data segment.
See also
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/dos.h/_heaplen/
· short form /3.1/_heaplen/