www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Doc suggestion - change in "D for Win32" section

reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
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! 
Jul 22 2005
parent "Walter" <newshound digitalmars.com> writes:
Good catch. Done. -Walter
Jul 23 2005