Jump to content
  • Advertisement
Sign in to follow this  

Inexpensive alternitive to commercial error detection

This topic is 5194 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was just wondering if a good error/resource leak detection tool is available that is similar to the commercial tools like Purify, and Boundschecker, cause who has $1000 to lay down on an app?

Share this post

Link to post
Share on other sites
When in c++, I do this:

#include <crtdbg.h>

using namespace std;

#ifdef _DEBUG
// new has 5 overloads. this one takes
// size_t, int const char*, int. size_t is filled
// in automatically by the compiler.
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)

void main(void)
// do some stuff for debug mode
#ifdef _DEBUG
// get current flags
int tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);

// don't free the blocks

// perform memory check for each alloc/dealloc

// Perform automatic leak checking at program exit through
// a call to _CrtDumpMemoryLeaks and generate an error report
// if the application failed to free all the memory it allocated.

// do main stuff here

It detects general memory leaks and the redefined new will tell you what file and line caused it. I'm sure it does nowhere near all the stuff the commercial programs do, but this is free and useful, and is in the standard library.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!