DB/DBMS in D
bearophile
bearophileHUGS at lycos.com
Mon Feb 16 05:05:18 PST 2009
Vladimir A. Reznichenko:
> In case of using GC deleted object is kept before reused. If GC operates on some range
> of addresses, and places all objects there (like using buffer) we get fragmentation. The
> longer we run process the harder to eliminate it.
When I have asked a similar question, people have told me that the current D GC allocates memory in blocks long as powers of two (until they become big enough) (this has also the consequence that saving few bytes in a struct is often an illusion, because if you use 9 bytes, the GC allocator gives you a 16 bytes long memory block. This happens in associative arrays too, so saving small amounts of memory is sometimes impossible. You have to use the C heap allocator or your own pools, arenas, etc).
I can also suggest you to perform some experiment, to try to fragment memory and to look at how the memory uses grows or not grows (and to show us the code). Experiments require a bit of time and they can be wrong, but very often they also show you interesting surprises, I have seen such "surprises" very often while doing speed benchmarks.
Bye,
bearophile
More information about the Digitalmars-d
mailing list