Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>These are relatively cheap mechanisms for possibly solving the problem:</p> <ol> <li>Keep an eye on my <a href="https://stackoverflow.com/questions/1069/heap-corruption-under-win32-how-to-locate">heap corruption question</a> - I'm updating with the answers as they shake out. The first was balancing <code>new[]</code> and <code>delete[]</code>, but you're already doing that.</li> <li>Give <a href="http://valgrind.org/" rel="nofollow noreferrer">valgrind</a> more of a go; it's an excellent tool, and I only wish it was available under Windows. I only slows your program down by about half, which is pretty good compared to the Windows equivalents.</li> <li>Think about using the <a href="http://code.google.com/p/google-perftools/" rel="nofollow noreferrer">Google Performance Tools</a> as a replacement malloc/new.</li> <li>Have you cleaned out all your object files and started over? Perhaps your make file is... "suboptimal"</li> <li>You're not <code>assert()</code>ing enough in your code. How do I know that without having seen it? Like flossing, no-one <code>assert()</code>s enough in their code. Add in a validation function for your objects and call that on method start and method end.</li> <li>Are you <a href="http://gcc.gnu.org/onlinedocs/gcc-4.3.0/cpp/Invocation.html#Invocation" rel="nofollow noreferrer">compiling -wall</a>? If not, do so.</li> <li>Find yourself a lint tool like <a href="http://www.gimpel.com/" rel="nofollow noreferrer">PC-Lint</a>. A small app like yours might fit in the <a href="http://gimpel-online.com/cgi-bin/genPage.py?srcFile=diy.cpp&amp;cgiScript=analyseCode.py&amp;title=Blank+Slate+(C%2B%2B)+&amp;intro=An+empty+page+in+which+to+write+your+own+C%2B%2B+code.&amp;compilerOption=co-gcc.lnt+co-gnu3.lnt&amp;includeOption=%7B%7BquotedIncludeOption%7D%7D" rel="nofollow noreferrer">PC-lint demo</a> page, meaning no purchase for you!</li> <li>Check you're NULLing out pointers after deleteing them. Nobody likes a dangling pointer. Same gig with declared but unallocated pointers.</li> <li>Stop using arrays. Use a <a href="http://en.wikipedia.org/wiki/Vector_(STL)" rel="nofollow noreferrer">vector</a> instead.</li> <li>Don't use raw pointers. Use a <a href="http://en.wikipedia.org/wiki/Smart_pointer" rel="nofollow noreferrer">smart pointer</a>. Don't use <code>auto_ptr</code>! That thing is... surprising; its semantics are very odd. Instead, choose one of the <a href="http://www.boost.org/doc/libs/1_35_0/libs/smart_ptr/smart_ptr.htm" rel="nofollow noreferrer">Boost smart pointers</a>, or something out of <a href="http://en.wikipedia.org/wiki/Loki_(C%2B%2B)" rel="nofollow noreferrer">the Loki library</a>.</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload