Discussion:
How to find where the program's memory leak?
(too old to reply)
LeeTow
2004-09-04 08:11:31 UTC
Permalink
I run a debug build in the debugger and find:detected memory leaks!
and followed some files name,for example strcore.cpp,occmgr.cpp,plex.cpp,
map_pp.cpp,but I don't write these files,I want to know where the program's
memory leak?Could you tell me?
ATField
2004-09-05 11:38:15 UTC
Permalink
Try some 3rd party tools. Boundschecker is probably a good choice.

---
ATField
Post by LeeTow
I run a debug build in the debugger and find:detected memory leaks!
and followed some files name,for example strcore.cpp,occmgr.cpp,plex.cpp,
map_pp.cpp,but I don't write these files,I want to know where the program's
memory leak?Could you tell me?
Joseph M. Newcomer
2004-09-06 03:59:58 UTC
Permalink
strcore.cpp is a CString object. You have created a CString and not deleted it. Similarly,
occmgr.cpp, plex.cpp, and map_pp.cpp are part of the MFC runtime. You are calling
something that calls functions in these modules that allocate storage, and you are not
freeing that storage. So you have to find where you are calling these components, what you
are allocating, and make sure you delete it.
joe
Post by LeeTow
I run a debug build in the debugger and find:detected memory leaks!
and followed some files name,for example strcore.cpp,occmgr.cpp,plex.cpp,
map_pp.cpp,but I don't write these files,I want to know where the program's
memory leak?Could you tell me?
Joseph M. Newcomer [MVP]
email: ***@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Simon
2004-09-07 00:09:17 UTC
Permalink
Try add this to your code:
_CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_ALLOC_MEM_DF |
_CRTDBG_LEAK_CHECK_DF);

The above gives you info about your memory leaks. You can get the
memory allocation number from the above results and then run
_CrtSetBreakAlloc to try and step through the sections involved in the
memory leaks.

Simon Hayden
http://www.AutoUpdatePlus.com
Get software updates to your clients the Quick and Easy way!
Latest Version ==========>>> Client Computer

Continue reading on narkive:
Loading...