Just curious if my destructors are being called.
(Specifically for Visual Studio, when you hit the red stop button)
Asked
Active
Viewed 827 times
3

BlueRaja - Danny Pflughoeft
- 84,206
- 33
- 197
- 283
-
2Where in the C++ standard does it specify how vendors implement their debugging behaviour in IDEs? – Shaggy Frog May 15 '10 at 03:11
-
1@Shaggy Frog: The C++ standard doesn't specify anything about debugging in IDEs, and the OP knows that: "since this doesn't seem like something that would be designated by the standard" – Dustin May 15 '10 at 03:20
2 Answers
5
No the process is terminated in VS2005, VS2008 and VS2010 when you press stop debugging.
You can easily check this by making a destructor that writes something to a file (and flushes output).
I'm not sure what standard you mean, but there is no standard that would define this behavior.

Brian R. Bondy
- 339,232
- 124
- 596
- 636
-
So then resources are never released? The reason I ask is that I've been asked to fix some DirectX code which crashes the *second* time it is run, if the first time was stopped mid-debug session. – BlueRaja - Danny Pflughoeft May 15 '10 at 04:05
-
2@blueRaja: Windows will free up any allocated memory handles on the heap and reclaim any unclosed file handles upon process termination. It may not do it immediately, but it usually does it within a few seconds. Destructors will not be called though, so if you for example write to a file in a destructor, then this output will not happen. Also there are probably some resources which windows can't reclaim. – Brian R. Bondy May 15 '10 at 04:32