DB/DBMS in D

Vladimir A. Reznichenko kalessil at gmail.com
Mon Feb 16 01:53:14 PST 2009


== Quote from Chris R Miller (lordsauronthegreat at gmail.com)'s article
> Vladimir A. Reznichenko wrote:
> > Dear Mr./Ms.,
> >
> >
> > I'd like to ask you about the garbage collector.
> > It slows down an application, doesn't it?
> >
> > In case of DBMS, this is critical. I haven't found any articles or tests
> > about this.
> >
> > Also it would be great to find out about memory management implemented in
> > DMD: fragmentation, allocation, reallocation. And if wide-known algorithms are used
there could it be named?
> >
> > The C/C++ is classic choice for such projects (DBMS), but the D language
> > is great one and the best for me ). I want to find out abilities of using
> > it.
> I would argue the opposite: that in a long-running process such as an
> RDBMS you would *want* the garbage collector to ensure that there are no
> memory leaks.  You could have either a super-fast database which leaks
> memory (so your users would have to restart it periodically) OR you
> could use a garbage collector, take the performance penalty (not that
> much - quite frankly, complaining about the garbage collector is like
> complaining that the silverware is gold and not platinum) and have the
> assurance that your memory leakage will be kept to an absolute minimum
> (or not at all, if you remember to properly declare weak references).
> Obviously it is possible to use a language like C++ and write code which
> doesn't leak memory... however, that level of effort isn't going to give
> you significant increases in performance compared to D.  D is just plain
> fast.

That's clear.

The thing that's not clear for me is memory fragmentation level.
In C++ memory is deallocated as soon as object is deleted.

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.

But if GS stores collection of object pointers, located somewhere in memory in undefined
order then, of course, we can find deleted object, update it and reuse - this could be
even faster.

Which of these 2 ways is implemented in DMD GC?



More information about the Digitalmars-d mailing list