delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/09/10:54:39

From: kagel AT quasar DOT bloomberg DOT com
Date: Thu, 9 Jan 1997 10:05:55 -0500
Message-Id: <9701091505.AA13635@quasar.bloomberg.com >
To: pajonk AT ajax DOT umcs DOT lublin DOT pl
Cc: djgpp AT delorie DOT com
In-Reply-To: <5alsge$fj0$1@helios.man.lublin.pl> (pajonk@ajax.umcs.lublin.pl)
Subject: Re: how to free memory?
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   From: pajonk AT ajax DOT umcs DOT lublin DOT pl (Grzegorz Ludorowski)
   Date: 4 Jan 1997 15:20:46 GMT

   I've got a problem with "free" (or "xfree") routines - it's silly I know,
   but they seems not to work...
   I tried program listed below, and after freeing that "dummy" pointer,
   free memory doesn't change... If anybody coud test it and help.

   #include <stdio.h>
   #include <dpmi.h>
   #include <crt0.h>

   int *dummy;

   void main () {
	    printf ("At start:                   physical mem %d   virtual mem %d\n",_go32_dpmi_remaining_physical_memory (),_go32_dpmi_remaining_virtual_memory ());
	    dummy = (int*) malloc (100000);
	    printf ("After allocating 100kbytes: physical mem %d   virtual mem %d\n",_go32_dpmi_remaining_physical_memory (),_go32_dpmi_remaining_virtual_memory ());
	    free (dummy);
	    printf ("After releasing 100kbytes:  physical mem %d   virtual mem %d\n",_go32_dpmi_remaining_physical_memory (),_go32_dpmi_remaining_virtual_memory ());
   }

No problem!  The memory is not returned to DPMI when free()'d only to the
malloc() memory pool.  This is why _dpmi_remaining_physical_memory() & 
_go32_dpmi_remaining_virtual_memory() report no change.

-- 
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com

A proverb is no proverb to you 'till life has illustrated it.  -- John Keats

- Raw text -


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