{"id":3918,"date":"2014-03-30T06:23:41","date_gmt":"2014-03-30T06:23:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/boost-causes-an-invalid-block-while-overloading-new-delete-operators-collection-of-common-programming-errors\/"},"modified":"2014-03-30T06:23:41","modified_gmt":"2014-03-30T06:23:41","slug":"boost-causes-an-invalid-block-while-overloading-new-delete-operators-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/boost-causes-an-invalid-block-while-overloading-new-delete-operators-collection-of-common-programming-errors\/","title":{"rendered":"Boost causes an invalid block while overloading new\/delete operators-Collection of common programming errors"},"content":{"rendered":"<p>I have a problem which appears to a be an invalid memory block that happens during a Boost call to <code>Boost:runtime:cla::parser::~parser<\/code>. When that global delete is called on that object, C++ asserts on the memory block as an invalid:<\/p>\n<pre><code>dbgdel.cpp(52):\n\n\/* verify block type *\/\n_ASSERTE(_BLOCK_TYPE_IS_VALID(pHead-&gt;nBlockUse));\n<\/code><\/pre>\n<p>An investigation I did revealed that the problem happened because of a global overloading of the new\/delete operators. Those overloadings are placed in a separate DLL. I discovered that the problem happens only when that DLL is compiled in RELEASE while the main application is compiled in DEBUG.<\/p>\n<p>So I thought that the Release\/Debug build flavors might have created a problem like this in Boost\/CRT when overloading new\/delete operators. So I then tried to explicitly call to _malloc_dbg and _free_dbg withing the overloading functions even in release mode, but it didn&#8217;t solve the invalid heap block problem.<\/p>\n<p>Any idea what the root cause of the problem is? is that situation solvable?<\/p>\n<p>I should stress that the problem began only when I started to use Boost. Before that CRT never complained about any invalid memory block. So could it be an internal Boost bug?<\/p>\n<p>Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a problem which appears to a be an invalid memory block that happens during a Boost call to Boost:runtime:cla::parser::~parser. When that global delete is called on that object, C++ asserts on the memory block as an invalid: dbgdel.cpp(52): \/* verify block type *\/ _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead-&gt;nBlockUse)); An investigation I did revealed that the problem happened [&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-3918","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3918","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=3918"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3918\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}