🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #995

Re: memory control blocks?

#995
From: walt dixon
Date: Thu, 19 Jul 1990 20:45
35 lines
1979 bytes
In <90199.195855TOMIII@MTUS5.BITNET> Thomas Dwyer III asks:

>How does one "follow the chain of memory control blocks" to determine
>what program is using what memory?  I would like to write my own program
>which determines where all my memory is going.  If I use INT 21, AH=52
>to get the first block, how do I get to the next block, etc?

For DOS 3.x,  int 21h AH=52 returns a pointer to a list of DOS data structures
in es:bx.  es:[bx-2] contains the paragraph of the first memory control
block.  Each memory control block has the following structure:

Field		Size	Use
Signature	BYTE	A value of 'M' indicates a normal Memory control block
			A value of 'Z' indicates the last Memory control block
Owner		WORD	PSP of block owner
			0 if not allocated
Size		WORD	size in paragraphs of MCB (not including header)
Unused		BYTE[11]

To get from one MCB to the next add the size+1 to the paragraph of the
current header.  You must check the signature field to find the end of
the chain.  A value of zero in the owner field indicates a free block.
NB that there are some strange values for MCBs allocated to device drivers
(8, from memory) that don't correspond to a PSP but still indicate
the block is owned.

I hope this helps

Walt Dixon	{internet:	dixon@crd.ge.com	}
		{us mail:	ge crd			}
		{		po box 8		}
		{		schenectady, ny 12301	}
		{phone:		518-387-5798 (W)	}
		{		518-875-6203 (H)	}
Walt Dixon dixon@crd.ge.com
Technical Details
Message-ID: <9976@crdgw1.crd.ge.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!crdgw1!sagittarius!dixon
References: <90199.195855TOMIII@MTUS5.BITNET>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!crdgw1!sagittarius!dixon
From: dixon@sagittarius.crd.ge.com (walt dixon)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: memory control blocks?
Message-ID: <9976@crdgw1.crd.ge.com>
Date: 19 Jul 90 20:45:09 GMT
References: <90199.195855TOMIII@MTUS5.BITNET>
Sender: news@crdgw1.crd.ge.com
Reply-To: dixon@sagittarius.crd.ge.com (walt dixon)
Organization: General Electric Corp. R&D, Schenectady, NY
Lines: 35