Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!husc6!lownlab!kiely From: kiely@lownlab.harvard.edu (James P. Kiely) Newsgroups: comp.sys.ibm.pc Subject: determination of free memory Summary: How does one? Keywords: PSP memory MicroSoft_C astart crt0.o Message-ID: <1875@husc6.harvard.edu> Date: 19 May 89 02:04:01 GMT Sender: news@husc6.harvard.edu Reply-To: kiely@lownlab.harvard.edu (James P. Kiely) Organization: Lown Cardiovascular Laboratory, Harvard University Lines: 38 I am trying to figure out how one determines how much memory is available to a process, including that allocated to the process and that which could be allocated with "setblock" (int 21, func 4Ah), in DOS. I have a number of questions: 1) What is the word at offset 2 of the PSP really? According to Norton: ".. tells how much memory is available by listing the segment-paragraph address of the end of DOS memory. Multiplying this number by 16 [decimal] gives the total bytes that DOS considers usable. The DOS command CHKDSK reports the same amount. ..." After considerable finagling I have determined that this is the "Total Memory" field of CHKDSK not the "Free Memory" field. On my machine, an AT clone running PC-DOS 3.20, it is always A000h. Is there an easy way to get the "Free Memory" field? 2) In every book I have ever seen, they are very emphatic that a user process should not change any part of the PSP below offset 4Ch. The startup code for MicroSoft C (crt0.o , astart:) modifies offset 2 of the PSP. Why does MicroSoft C do this seemingly illegal behavior and is it indeed illegal? And what is the word at offset 2 of the PSP after astart: modifies it? 3) What is the correct way to determine how much core is available to a process? 4) What is the correct way to determine how much memory is available in the far heap? 5) Is the far/near heap a DOS concept or a MicroSoft C concept? Please respond via email. I will summarize responses to the net. Thanks. ============================================================================= NAME: James P. Kiely USPS: Kiely Laboratories USENET: ...!harvard!lownlab!kiely P.O. Box 624 DOMAIN: kiely@lownlab.harvard.edu Allston, MA 02134-0624 PHONE: +1 617 782 4136 USA