delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/03/13:45:25

Sender: nate AT cartsys DOT com
Message-ID: <377E4BED.3C8F1F12@cartsys.com>
Date: Sat, 03 Jul 1999 10:44:13 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.10 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Allocated memory blocks
References: <7ljrk1$d4$1 AT newssrv DOT otenet DOT gr>
Reply-To: djgpp AT delorie DOT com

Pavlos wrote:
> 
> Let's say I allocate any size of memory using malloc(). Can I always assume
> that this block of memory will not be fragmented? Even if it is huge?

Define "fragmented".  It will appear to your program as a contiguous
block of memory-- no holes.  But where, or even if, it exists in
physical memory is not guaranteed.  It may be physically scattered
across RAM, but the virtual memory mechanisms make this invisible to
you.

So, for the purposes of C, it's not fragmented.  For the purposes of DMA
or other external hardware, it may well be.
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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