Question: Is there any reason for a program to leak when compiled in Debug mode and not in release?

(Debug means debug informations, and compiler optimization disabled, Release means no debug info / full optimization)

That's what it seems to do but I can't figure out why. Btw purify is not being helpful here

Answer: 
How are you detecting the leak? If it's via the task manager, the MSVC debug implementation will keep freed memory around when the `_CRTDBG_DELAY_FREE_MEM_DF` flag is set.

It's also possible that you have a memory leak that does not exist in Release.

EDIT: You can also manually call `HeapCompact(GetProcessHeap(), 0)`. I seem to recall that the debug heap always grows (i.e., it doesn't return free blocks), but I can't find that documentation anywhere.
conditional `#ifdef _DEBUG` lines could be one reason.