Mail Archives: djgpp/2000/08/22/10:15:34
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 -