If
a TSR is created in assembly langauge, the programmer has exact control over
the use of memory and can omit the heap area and place the initialization code
at the end of the segment (where it can be released after initialization).
If
a TSR is created in C, the small-memory
model must be used. Because of the severe memory limitations, the programmer
should not use C allocation functions (such as malloc and calloc),
as these add to the heap. A small heap must be assigned because some C library
routines (such as fprintf) allocate memory from the heap.
Variables
required by MS-DOS interrupt handlers must be placed at the beginning of the
code segment.