delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/22/15:48:25

From: Paul Shirley <Paul AT chocolat DOT foobar DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Virutal memory problems.
Date: Mon, 21 Oct 1996 23:30:43 +0100
Organization: DrinkSoft
Lines: 23
Distribution: world
Message-ID: <kReHGGATm$ayEwVX@chocolat.foobar.co.uk>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 961020074010 DOT 29425L-100000 AT is>
<845921032 DOT 28340 DOT 0 AT abwillms DOT demon DOT co DOT uk>
NNTP-Posting-Host: chocolat.foobar.co.uk
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <845921032 DOT 28340 DOT 0 AT abwillms DOT demon DOT co DOT uk>, "Alaric B.
Williams" <alaric AT abwillms DOT demon DOT co DOT uk> writes
>How serious is that power-of-two waste - in that is it then free for
>the next allocation to be taken from (ie if I then request 32-18 =
>14Mb will it not 'allocate' any more), or is it really that bad?

In one sense it really is wasted, the block is allocated and you won't
suddenly find it reused. However virtual memory paging will almost
certainly scavenge the unused pages if required, though frankly I prefer
to avoid the wastage in the first place.

>
>If so, what's the point? Surely it's no slower to allocate to the
>nearest word?

The binary bin algorithm used is *incredibly* fast at allocating memory,
and on machines with properly implemented virtual memory not necessarily
wasteful. It also avoid memory fragmentation. Allocating to the nearest
word is harder to manage. It is of course possible to substitute your
own malloc routine ;)

-- 
Paul Shirley

- Raw text -


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