{"id":3964,"date":"2014-03-30T06:44:31","date_gmt":"2014-03-30T06:44:31","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/visual-studio-2005-c-runtime-new-exception-collection-of-common-programming-errors\/"},"modified":"2014-03-30T06:44:31","modified_gmt":"2014-03-30T06:44:31","slug":"visual-studio-2005-c-runtime-new-exception-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/visual-studio-2005-c-runtime-new-exception-collection-of-common-programming-errors\/","title":{"rendered":"Visual Studio 2005 C++ runtime new exception-Collection of common programming errors"},"content":{"rendered":"<p>I have a VS 2005 C++ project with both Debug and Release builds. I&#8217;ve attempted the following 4 things:<\/p>\n<ol>\n<li>Build a Debug executable through Visual Studio, and run it through Visual Studio.<\/li>\n<li>Run the executable built in (1) externally via command line (Cygwin) after <code>cd<\/code>&#8216;ing to <code>vstudio\/debug<\/code>.<\/li>\n<li>Build a Release executable through Visual Studio, and run it through Visual Studio.<\/li>\n<li>Run the executable built in (3) externally via command line (Cygwin) after <code>cd<\/code>&#8216;ing to <code>vstudio\/release<\/code>.<\/li>\n<\/ol>\n<p>The first 3 all succeed: the program runs to completion.<\/p>\n<p>The fourth, however, crashes at runtime. Debugging shows that the culprit is the call to <code>malloc()<\/code> inside the operator <code>new()<\/code>. The relevant context looks something like this:<\/p>\n<pre><code>template class Foo {\n    ...\n    static void bar() {\n        ...\n        T* ptr = new T();\n        ...\n    }\n    ...\n}\n<\/code><\/pre>\n<p>If anyone can think of any problem which would lead to the 3-out-of-4 symptoms I describe, it would be much appreciated.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a VS 2005 C++ project with both Debug and Release builds. I&#8217;ve attempted the following 4 things: Build a Debug executable through Visual Studio, and run it through Visual Studio. Run the executable built in (1) externally via command line (Cygwin) after cd&#8216;ing to vstudio\/debug. Build a Release executable through Visual Studio, and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3964","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3964"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3964\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}