Questions tagged [crtdbg.h]
26 questions
24
votes
2 answers
_CRTDBG_MAP_ALLOC not showing file name
I am trying to detect memory leak, and I am using make _CRTDBG_MAP_ALLOC macro to locate where the leaks area. So I am defining MACRO like following:
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include
#include
#define…

Nick X Tsui
- 2,737
- 6
- 39
- 73
15
votes
2 answers
Why might _CrtSetBreakAlloc not cause a breakpoint?
I'm using Visual CRT's memory leak detection routines from ; when I call _CrtDumpMemoryLeaks one allocation is reported consistently on every invocation of the program:
{133} normal block at 0x04F85628, 56 bytes long.
Data: < …

Roman Starkov
- 59,298
- 38
- 251
- 324
8
votes
1 answer
replacing new with macro conflicts with placement new
I've got a massive application (several million LOC, and tens of thousands of files), and I'm trying to use the debug crt to detect memory leaks. I'm trying to macro-ize new like so:
#define _CRTDBG_MAP_ALLOC
#include
#ifndef…

C.J.
- 15,637
- 9
- 61
- 77
8
votes
3 answers
Visual Studio memory leak detection not printing file name and line number
I want to check my program for memory leaks and found this Microsoft article.
I thoroughly followed the article and added
#define CRTDBG_MAP_ALLOC
#include
#include
and
_CrtDumpMemoryLeaks();
when the program exits.
It…

A. D.
- 728
- 1
- 9
- 27
5
votes
3 answers
Memory Leak Detection File Error
I have a program that is supposed to output info on its memory leaks. However, it is not working. Following is the program:
#include
#include
#include
#include
int WINAPI WinMain (HINSTANCE hInstance,…

GILGAMESH
- 1,816
- 3
- 23
- 33
4
votes
4 answers
Override new operator in C++ while crtdbg.h is causing conflicts
While trying out some memory tracking and preparation for my own memory manager, I tried to override the new operator. The article on flipcode was my main guideline in this process ( http://www.flipcode.com/archives/How_To_Find_Memory_Leaks.shtml…

Evil Activity
- 889
- 1
- 11
- 21
3
votes
1 answer
How to trace the source of a CRT debug memory leak output from managed C# code?
I'm running a software written in C# (WPF) that uses a lot of native legacy code. When I close the software, the debugger keeps running and my debug output screen prints this:
Detected memory leaks!
Dumping objects ->
{41198} normal block at…

asaf92
- 1,557
- 1
- 19
- 30
3
votes
1 answer
VsCode crtdbg.h not found, how to fix?
Trying to check memory leak tool but Vscode doesn't recognize #include .
Here is the code:
#define _CRTDBG_MAP_ALLOC
#include
#include
#include
#include
int main()
{
char *word = "this still…

Jackpot
- 47
- 1
- 5
3
votes
3 answers
Visual Studio _CrtDumpMemoryLeaks always skipping object dump
I'm trying to use the CRT memory leak detection but I keep getting the following message in Microsoft Visual Studio: "Detected memory leaks - skipping object dump." I can never get the it to actually do and object dump.
I followed the directions in…

Kiril
- 39,672
- 31
- 167
- 226
3
votes
2 answers
Error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
I am trying to compile the cpp code in visual studio 2013. It was working fine earlier. But now I am getting following error:
Error 1 error C1083: Cannot open include file: 'crtdbg.h': No such
file or directory C:\Program Files (x86)\Microsoft…

Ashwani Kumar
- 31
- 1
- 2
2
votes
0 answers
Detecting memory leaks using _CrtDumpMemoryLeaks
This is my first time using the CRT library for detecting memory leaks, and I'm using Visual C++ 2003. As mentioned in this website, I included the statements in my program
#define _CRTDBG_MAP_ALLOC
#include
#include
followed…

Rayne
- 14,247
- 16
- 42
- 59
2
votes
3 answers
How to detect leaks under WinCE C/C+ runtime library?
I know the possibilities of basic leak detection for Win32 using the crtdbg.h header, but this header is unavailable in the CE CRT library headers (i'm using the lastest SDK v6.1).
Anyone knows how I can automatically detect leaks in a WinCE/ARMV4I…

Hernán
- 4,527
- 2
- 32
- 47
2
votes
0 answers
memory leak on BOOST_LOG_TRIVIAL using _CrtDumpMemoryLeaks
I'm using visual studio 2010 and boost library. I'm trying to find memory leak using _CrtDumpMemoryLeaks called after the main function exits. I'm pretty sure boost_log_trivial doesn't leak memory. How to avoid this false positive?
Source…

Pritesh Acharya
- 1,596
- 5
- 15
- 36
2
votes
1 answer
Reset high water count in CRT debug heap
The _CrtMemState struct returned by _CrtMemCheckpoint() includes a size_t lHighWaterCount member which gives the maximum memory usage since the application started. I'm writing a testing rig which cares about high water marks, but it runs several…

Sneftel
- 40,271
- 12
- 71
- 104
2
votes
3 answers
Memory leaks detection while using Boost
I would like to get the memory leaks information using _CRTDBG_MAP_ALLOC, and especially the files and line numbers, but I don't get them at the end. I only get something like this:
{130} normal block at 0x00695128, 16 bytes long.
Data: <\ E …

TigrouMeow
- 3,669
- 3
- 27
- 31