Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site mcnc.mcnc.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!houxm!whuxl!whuxlm!akgua!mcnc!jnw From: jnw@mcnc.UUCP (John White) Newsgroups: net.micro.pc Subject: Re: Removing a memory-resident program -- Help Message-ID: <1005@mcnc.mcnc.UUCP> Date: Wed, 20-Nov-85 23:16:37 EST Article-I.D.: mcnc.1005 Posted: Wed Nov 20 23:16:37 1985 Date-Received: Sat, 23-Nov-85 03:40:16 EST References: <280@well.UUCP> Organization: Microelectronics Center of NC; RTP, NC Lines: 18 > When removing a previously loaded memory-resident program we cannot > recover all of the memory. It appears that DOS keeps 64 bytes each > time. What's the trick to getting back ALL of your memory when > removing a resident program?? > Doug Kaye > Rational Data Systems > ihnp4!hplabs!well!drk A memory-resident program has two blocks associated with it. There is the main block, and the environment block. The segment of the environment block is pointed to by offset 2C of the Program Segment Prefix. Freeing both blocks with the dealloc call will recover all memory and completely remove the memory-resident program. Whenever I write a terminate-and-stay-resident program I have an alternate invocation of that command to remove the program. I find this quite usefull. (Actually, I usually free the environment block just before the terminate-and-stay-resident system call, and so I only have to free the main block to remove the program. Either way works.)