DMD 1.001

January 24th, 2007 | by Aldacron |

The latest release of DMD contains a handful of bug fixes, but the spotlight is on a shiny new garbage collector implementation.  The new implementation aims to improve performance by being type-aware. This has the potential to break existing code that does a lot of casting between types. It is suggested that if you plan to cast a variable to another type, you should declare it as void[] memory. Here’s an example Walter gave in an earlier NG post:

struct Foo { … };

Foo[] f;

p = new void[100];

f = cast(Foo[])p;    // ok

byte[] b = cast(byte[])p;

f = cast(Foo[])b;    // ok, GC still regards memory as void[]

p = new byte[100];

f = cast(Foo[])p;    // will likely eventually corrupt memory

So watch out for that. If you need to revert to the old GC, you can do so via a runtime call: std.gc.setV1_0().

Wow, two of my biggest gripes about D (debugging and GC performance) have been addressed this week. If this keeps up, I’ll have nothing to complain about! I’m also starting to feel guilty for choosing C over D for a project I’m working on now. Please, stop with all of the improvements, Walter!

Technorati Tags: , , , ,

3 Responses to “DMD 1.001”

  1. By John on Jan 24, 2007

    I was very excited about the GC too but several people have posted bugs (some pretty serious) that seem to be directly related to it. Hopefully they get resolved soon.

  2. By Aldacron on Jan 24, 2007

    Walter’s pretty good at getting fixes in quick when he breaks something. So I’m sure we’ll see a fix soon. I just wish he had released the latest version as a separate branch. He probably ought to divide the downloads up into ‘current release’ and ‘development version’, or ’stable’ and ‘unstable’, or something of the sort. That way, when he does break something it’s not in the main release.

  3. By John on Jan 25, 2007

    Very true. He has already noted that he’ll have a fix soon and that they’re pretty easy fixes.

Post a Comment