delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/31/21:02:28

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: malloc & free
Date: Tue, 31 Mar 1998 18:54:23 -0500
Organization: Two pounds of chaos and a pinch of salt.
Lines: 24
Message-ID: <3521822F.6B13@cs.com>
References: <352140E9 DOT D07CEE53 AT krona DOT obninsk DOT ru>
NNTP-Posting-Host: ppp225.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Denis V.Sorokovik wrote:
> 
> Here is my problem. I write program, that works with memory arrays and
> allocates arrays dynamically. I'm calling malloc(size), working with
> array, then freeing (free(ptr)). dpmi function
> __dpmi_get_free_memory_information says, that largest available free
> block in bytes didn't increases in size, when I freed array, and
> total_number_of_free_pages decreased too. I use DJGPP 2.01, cwsdpmi 4.
> Can anybody helps me with this question?

The answer is quite simple:  DJGPP's malloc()/free() does not return
freed memory blocks to the system; it keeps track of them for possible
reuse later.  At program termination, all allocated memory is returned
to the DPMI host.

-- 
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>  UIN# 7406319

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? C++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---)
O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++
e(*)>++++ h!() !r !y+()
------END GEEK CODE BLOCK------

- Raw text -


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