English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
[Caml-list] Garbage collector and memory fragmentation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] Garbage collector and memory fragmentation
> <This question is not specific to OCaml, but rather to garbage
> collection.>
> 
> I have a program (in Fortran90) that uses many (> 100.000) small lists
> of integers ( about 100 elements per list ). Each list is built
> incrementally => I allocate many small blocks. It appears that this
> leads to memory fragmentation. For instance, even though I deallocate
> all the lists, the memory used by the program does not seem to really
> decrease.
> My question is : does a garbage collector (for instance the one in
> OCaml) deal with this kind of issues ( defragmentation of the memory )
> in a situation similar to mine : many small lists of elements ?

It depends on the allocation and garbage collection algorithms used.
For instance, relocating garbage collectors (stop&copy collectors, or
in-place compactors) prevent fragmentation, while garbage collectors
that do not move objects around (mark&sweep, reference count) are
vulnerable to fragmentation issues.  Even for non-relocating
collectors, the allocation strategy also has an impact on how much
fragmentation occurs.  

To learn more, I'd recommend Paul Wilson's excellent surveys:

ftp://ftp.cs.utexas.edu/pub/garbage/gcsurvey.ps    (on GC)
ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps    (on allocation)

- Xavier Leroy
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners