delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/01/02/21:57:44

Date: Sat, 02 Jan 1993 19:45:22 EST
From: sandmann AT clio DOT rice DOT edu (Charles Sandmann 713-493-8756)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Malloc behavior and interrupts

OS/2 has an variable that is set in the config.sys file which indicates the
minimum amount of free disk space which should be left when expanding the
paging file.  If the free space on the disk containing the paging file drops
below that value, the paging file will not grow past that point.  Additional
requests for memory fail at that point (ie, malloc() returns NULL).  This 
is really nice behavior, since you can configure the threshold as you want,
and leaves enough disk space to recover from a bind (and signals the problem
with the NULL pointer).  There is also a function (a holdover from V1.x) which
can be used to request the amount of free memory.  This function under OS/2 2.0
returns the amount of free RAM, not virtual memory.  To be complete, you would
probably want both - so you don't allocate huge amounts of workspace to speed
up an algorithm and find out you spend all your time paging...

As far as interrupt handling, there are two paths I am aware of.  One is the
TSR route, and the other is to modify GO32 itself.  The event library is
an example of the code imbedded in GO32, the async library the TSR approach.
Since source code is available for both, I don't think there is any interrupt
handling you couldn't do with modified copies of these two routines.  GO32 is
a DOS extender - so I think you have to be willing to get down to the DOS level
(low and ugly) to do this sort of stuff.  DJ and CB (and hosts of others) have
been kind enough to provide us with their source code - great examples of how
to do the hard stuff.  I would encourage everyone with a difficult project to
plunge in, understand how it works, modify it to meet your needs, and post it
if it meets a general need!  Ie, if you don't like DJGPP change it!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019