[comp.sys.ibm.pc] MSC 5.1 Far Heap size

byu@csri.toronto.edu (Benjamin Yu) (08/24/88)

I am posting the following for a friend, please reply directly to
Greg Greaves (address below).

==============================================================================
Hello,

Could anybody out there tell me of an easy and reliable way to get the
size of the far heap in MSC 5.1 small model?  I am doing _fmalloc()'s
and need to know the available far heap size before-hand.

I tried using _dos_allocmem( 0xFFFF, &size ) to ask for a meg and looked at the available
memory that it returned in the second parameter.  This is fine and dandy
except that this value does not change when memory is allocated with _fmalloc()
and subsequent calls are made to _dos_allocmem().  I need something that works
with _fmalloc().

I have a routine that allocates until it can't anymore but its a kludge
and I know there must be a more elegant way to go about this.

Any help would be appreciated.   If you prefer e-mail to posting your
response, please e-mail me at ...!moore!dhstor!greg as this message was posted
from another machine.

Thanks in advance,
-Greg Greaves ( greg@dhstor.UUCP )

kneller@cgl.ucsf.edu (Don Kneller) (09/07/88)

In article <8808242111.AA06402@ellesmere.csri.toronto.edu> byu@csri.toronto.edu (Benjamin Yu) writes:
>Could anybody out there tell me of an easy and reliable way to get the
>size of the far heap in MSC 5.1 small model?  I am doing _fmalloc()'s
>and need to know the available far heap size before-hand.

On a related note, I would like to know the "high-water mark" of the heap.
In essence I need to know how much memory my program is taking up.
Any help would be greatly appreciated.

- don
-----
	Don Kneller
UUCP:		...ucbvax!ucsfcgl!kneller
INTERNET:	kneller@cgl.ucsf.edu
BITNET:		kneller@ucsfcgl.BITNET

kneller@cgl.ucsf.edu (Don Kneller) (09/08/88)

I would like information on how DOS manages memory with the int 21H
services of allocate memory and setblock.  In particular, given the
PSP of a program, can I track the chain of blocks allocated to the
program.  It seems reasonable that I can, since DOS has to know which
blocks to free once a program terminates.  I would like to track the
chain of blocks to determine exactly how much memory my program is
using.  Also, I need to be able to free the chain, then recreate it
at a later time.

- don
-----
	Don Kneller
UUCP:		...ucbvax!ucsfcgl!kneller
INTERNET:	kneller@cgl.ucsf.edu
BITNET:		kneller@ucsfcgl.BITNET