From: "John M. Aldrich" 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: <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 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 -----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------