delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/22/10:15:34

From: "Edmund Horner" <ejrh AT paradise DOT net DOT nz>
Newsgroups: comp.os.msdos.djgpp
References: <8ns0va$qv4$1 AT info DOT cyf-kr DOT edu DOT pl>
Subject: Re: Memory question
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Organization: Paradise Net
Message-ID: <966953132.588023@shelley.paradise.net.nz>
Cache-Post-Path: shelley.paradise.net.nz!unknown AT 203-96-158-195 DOT tnt4 DOT paradise DOT net DOT nz
X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)
Date: Tue, 22 Aug 2000 16:33:57 +1200
NNTP-Posting-Host: 203.96.152.26
X-Complaints-To: newsadmin AT xtra DOT co DOT nz
X-Trace: news.xtra.co.nz 966953152 203.96.152.26 (Wed, 23 Aug 2000 02:05:52 NZST)
NNTP-Posting-Date: Wed, 23 Aug 2000 02:05:52 NZST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Yes, I think that will defrag memory, however, it won't realease it back to
the OS.

The defragging will happen when the malloc implementation automatically
concatenates freed blocks, when all blocks are free, memory will be one big
free block.  But this block is still owned by the program, and doesn't go
back for other running tasks to use.

(But this hardly matters, because if other tasks need more memory your
program's block will just get stuck on disk.)
"Rafał Maj" <r_maj AT poczta DOT onet DOT pl> wrote in message
news:8ns0va$qv4$1 AT info DOT cyf-kr DOT edu DOT pl...
> Hi,
> I just wanted to know, if unloading & re-loading all data from memory will
> cause something like memory defragmentation ?
> What do You think about this example pseudo-program :
>
> main() {
>   1) Allocating some memory for few small arrays.
>   2) Loading data to memory
>   In loop  {
>     3) Allocating many small buffers
>     4) deallocating all memory from 3)
>   }
>   --- now memory is now probably fragmented ---
> defragmentation :
>   5)  Deleting all data from 2)
>   6)  Re-loading all data
> }
>
> FINAL QUESTION :
> I think, that all memory (above arrays allocated in 1) ) will be now
totally
> defragmentate, right ???
>
> Thanks
>
>
>






- Raw text -


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