Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!rutgers!njin!princeton!phoenix!jwbirdsa From: jwbirdsa@phoenix.Princeton.EDU (James Webster Birdsall) Newsgroups: comp.sys.ibm.pc Subject: DOS memory allocation Keywords: fooling with DOS's mind Message-ID: <8261@phoenix.Princeton.EDU> Date: 10 May 89 01:46:50 GMT Organization: Princeton University, NJ Lines: 30 I need to be able to permanently allocate memory from a memory-resident piece of code WHILE running an application without fragmenting the memory when the application exits. It occurred to me that an easy way to do this would to be allocate memory from the top down instead of bottom up, as usual. Can DOS be persuaded to do this in an elegant manner? If not, can it be kluged like so: if we need X kbytes and there are N left, allocate a block of N-X, then the block of X, then deallocate the first? Or would allocating from the top down also count as fragmenting and cause DOS to vaporize? Assuming it can't be done, could I hook the exit interrupt and, when it is called, call it and then somehow paw through the allocation chain to find holes? Another random thought: I seem to recall hearing that DOS allocates all available memory to .COM programs. Is this true? If it is, does it spell certain doom for my plans? Yet another random thought: saw somebody praising the program MAPMEM recently. I have version 2.1; I will admit that it's a nice program, but sometimes using it causes some of my other memory mappers to scream that the memory allocation chain has been corrupted! Don't know whether it's MAPMEM's fault or not. Anyway, thanx for any thoughts on the questions above... -- James W. Birdsall jwbirdsa@phoenix.Princeton.EDU jwbirdsa@pucc.BITNET ...allegra!princeton!phoenix!jwbirdsa Compu$erve: 71261,1731 "For it is the doom of men that they forget." -- Merlin