delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/05/09:26:25

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allocating and using memory with the dpmi functions
Date: Sun, 05 Jan 1997 08:31:30 -0800
Organization: Two pounds of chaos and a pinch of salt
Lines: 27
Message-ID: <32CFD762.25DC@cs.com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970102083550 DOT 17516B-100000 AT is> <19970104 DOT 000402 DOT 4727 DOT 1 DOT aclemmer AT juno DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp102.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Aaron m Clemmer wrote:
> 
> >Believe  me, you DON'T want to do that on your own without a *very* good
> 
> >reason!
>         I suppose there aren't many?

The malloc() routines are somewhat inefficient in that in order to
maintain a relatively fast system for tracking used and free blocks, the
size of all allocated memory is rounded up to the nearest power of 2. 
So, allocating 600 bytes gets you 1024, 50000 bytes gets you 65536, 1.5
MB gets you 2 MB, etc.  This usually isn't a problem for most people,
but if you really must have a more space-efficient memory management
system because of something your program does, you may consider using
some alternate techniques to minimize the block size loss.

Good luck!

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

-----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