July 23, 2005
I was running into some memory leaks in one of my Win32 programs in D recently.  I did some testing, and realized that memory that was being allocated in module ctors (static this()es) was never being deallocated, and that the module dtors were never being run.

I was using the WinMain template described in the "D for Win32" section of the help, and upon closer inspection, that code doesn't call the module dtors.  So, I suggest that the following extern line be added:

extern (C) void _moduleDtor();

And after the line

result = myWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);

The line

_moduleDtor();

Should be added.

Hoping to prevent others from dealing with this in the future!


July 23, 2005
Good catch. Done. -Walter