delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/24/02:53:50

Date: Mon, 24 Mar 1997 10:34:46 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Ilya P. Ryzhenkov" <ilya AT spy DOT isp DOT nsc DOT ru>
cc: djgpp AT delorie DOT com
Subject: Re: malloc & m/tasking OS
In-Reply-To: <33334341.471F@spy.isp.nsc.ru>
Message-ID: <Pine.SUN.3.91.970324103416.1059E-100000@is>
MIME-Version: 1.0

On Fri, 21 Mar 1997, Ilya P. Ryzhenkov wrote:

> AFAIK free() will return mem to local djgpp's heap, so
> OS will not be able to use that mem. Am I right ?

Yes.

> If so, how can I return mem to DPMI server ?

AFAIK, you can't, not without rewriting the code of `sbrk' function.
Currently, it doesn't return memory to the DPMI server at all.  If you
are concerned by the possibility that a program consumes more and more
memory from the system (that might be a concern in a program which
runs for prolonged periods of time), perhaps an alternative solution
would be to change (or replace) `malloc' and `free' so that they reuse
available memory more efficiently.  This is certainly *much* simpler
than messing with `sbrk' (whose code is very complex, semi-documented
and relies on some tricks required to overcome some problems in the
DPMI spec and bugs of some DPMI hosts).

- Raw text -


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