[comp.sys.ibm.pc] Releasing memory after loading a program

andrews@hpsal2.HP.COM (Edward E. Andrews) (10/19/87)

I am writing a program that does the following:

	- Modify memory allocation for my program (ah=4ah)
	- Load a program without executing (ah=4bh, al=01 [undocumented])
	- Do stuff
	- Release memory from the load above (ah=49h)

Now, when my program exits and I run CHKDSK, it will run but it will give me
a memory allocation error when it terminates.  If, however, I run a non-DOS
program the system will continue to run until CHKDSK is run again.  Appearently
COMMAND.COM will validate the memory control block chain when it gets reloaded
and I've messed it up.

I've verified that I'm releasing the proper segments and that they have
valid control blocks.

If anybody knows why this is going on please RSVP so I can get some sleep.