[omniORB] Memory leak profiling

Duncan Grisby duncan at grisby.org
Fri Apr 22 17:13:27 BST 2005


On Thursday 21 April, "Nitin Singhal" wrote:

> #ifdef _DEBUG
> #define new new(_NORMAL_BLOCK, SRC_FILE, __LINE__)
> #undef SRC_FILE
> static char SRC_FILE[] = __FILE__;
> #endif
> 
> int main()
> {
> 	_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
> 	// ...
> }
> 
> This is going to dump all the memory leak warning on the debugger
> output window at application exit.I need to do the [ #define new
> new(_NORMAL_BLOCK, THIS_FILE, __LINE__) ] in all the source files so
> that I can make sure that the leak report contains the correct source
> file line number.
> Is this a reasonable solution to a memory leak profiling on windows?
> And can I add it to the omniORB code ?

Well, you obviously can go and edit all the omniORB source files if you
feel like it, but it sounds like an awful lot of work to me. There are
memory debugging tools (Purify, for example) that don't require you to
modify all your code.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list