When command.com loads and executes a .com program, it allocates all available memory to the application and sets the stack pointer 100H bytes from the end of available memory. A .com program should set up its own stack before shrinking its initial memory-allocation block with Function 4AH (Set Block) because the default stack is in the memory to be released.
If a newly loaded program is allocated all of memory --- as a .com program is --- or requests all of available memory by using Function 48H (Allocate Memory), MS-DOS allocates to it the memory occupied by the transient part of command.com. If the program changes this memory, MS-DOS must reload the transient portion of command.com before it can continue. If a program exits (via Function 31H, Keep Process) without releasing enough memory, the system halts and must be reset. To minimize this possibility, a .com program should use Function 4AH (Set Block) to shrink its initial allocation block before doing anything else. Also, before exiting, all programs must release all memory they allocate by using Function 48H (Allocate Memory).