The problem with the D GC

kenny funisher at gmail.com
Mon Jan 8 08:24:21 PST 2007


I also have experienced bad GC performance. I found it to be because of 
the ~ operator on strings. The program is a daemon, and after it had 
been running for a while, memory usage gets truly horrific, and 
performance degrades very bad.

This was back on 0.140, so things may have changed since then...

I solved two ways. First, I wrote a function which accepts variadic 
arguments, and separated everything by a comma instead of appending the 
strings and the performance difference was stunning. it was also nice to 
be able to write:

prt("string", my_int, " ", my_float, "string2");

instead of

"string"~std.string.toString(my_int)~" 
"~std.string.toString(my_float)~"string2"

Second, like someone else in this thread I also called fullCollect every 
second.

I used to use gdc-0.08 with boehm-gc too. I can't honestly remember if 
that had the same problem.

Tom S wrote:
> Oskar Linde wrote:
>> (...) gc hell (...)
> 
> I've experienced pretty much the same while doing memory-intensive 
> computations. Since then I've been using lots of malloc/realloc/free and 
> both my memory footprint and execution speed have improved. The GC needs 
> a fix. Badly.
> 
> 
> -- 
> Tomasz Stachowiak



More information about the Digitalmars-d mailing list