MS-DOS keeps track of memory by creating a linked list of the ARENA structures that define the sizes and owners of blocks of memory. The ARENA structure has the following form:
ARENA STRUC
arenaSignature db ? ;4dh = valid, 5ah = last
arenaOwner dw ? ;owner of arena item
arenaSize dw ? ;size of item, in paragraphs
arenaReserved db 3 dup(?) ;reserved
arenaName db 8 dup(?) ;owner filename
ARENA ENDS
For a full description of the ARENA structure, see Section 5.8, “Structures.”
When first starting, MS-DOS creates arenas for available memory. It creates additional arenas as needed when it loads programs and device drivers or as programs allocate their own memory. The number, size, and location of the arenas depend on the size of the memory blocks allocated.
Programs must not alter the ARENA structures. MS-DOS has no provisions for repairing structures that programs have overwritten or modified. If an ARENA structure is altered, functions such as Allocate Memory and Free Allocated Memory fail and return error value 0007h (ERROR_ARENA_TRASHED).