When the "use Debug version of DirectX 9" is checked in the DirectX Control Panel, somehow DirectX can see if DirectX interfaces are not released after when a program shuts down. Thus, the visual IDE will catch and display these GDK errors.
Yes the program exits with 0.
Here's an example of one of my programs that will compile and run fine, but while using the debug version of DirectX, set in the DirectX Control Panel, DirectX will catch unreleased resources:
[Edited bunch of times, shortened, keep getting "Unknown System Error while posting reply"]
Direct3D9: (INFO) :======================= Hal HWVP device selected
Direct3D9: (INFO) :Using FF to VS converter
Direct3D9: (INFO) :Using FF to PS converter
Direct3D9: (ERROR) :BeginScene, already in scene. BeginScene failed.
[heaps of lines like this that say the same thing]
Direct3D9: (WARN) :Can not render to a render target that is also used as a texture. A render target was detected as bound, but couldn't detect if texture was actually used in rendering.
The thread 'Win32 Thread' (0x12dc) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x12c0) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xd0c) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x10c4) has exited with code 0 (0x0).
Direct3D9: (ERROR) :Memory still allocated! Alloc count = 251
Direct3D9: (ERROR) :Current Process (pid) = 000003f0
[heaps of stuff like this]
Direct3D9: (ERROR) :Memory Address: 00f207f4 lAllocID=1 dwSize=00004bc4, ReturnAddr=65d399aa (pid=000003f0)
Direct3D9: (ERROR) :Memory Address: 00f253ec lAllocID=2 dwSize=0000031c, ReturnAddr=65d3c90a (pid=000003f0)
Direct3D9: (ERROR) :Memory Address: 00f2573c lAllocID=3 dwSize=00000c28, ReturnAddr=65d429d1 (pid=000003f0)
Direct3D9: (ERROR) :Memory Address: 00c4cc5c lAllocID=5 dwSize=0001cbc4, ReturnAddr=65d4a268 (pid=000003f0)
Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 5461844 bytes
The program '[1008] shadowmapexample.exe: Native' has exited with code 0 (0x0).