Deleting allocated memory

Hello there, I have a technical question (I think). Anyway I'm trying to understand how to know if I have a memory leak in my program and I read here: http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx , about _CrtDumpMemoryLeaks();. what I dont understand is the out put it gives me. I hope you could clear somethings to me.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include<iostream>
using namespace std;

int main()
{
	int* a = new int[10];
	int i = 0;
	while (i < 10)
	{
		a[i] = i;
		i += 1;
	}
//	delete[] a;
	_CrtDumpMemoryLeaks();
}


the out put I had is:

Detected memory leaks!
Dumping objects ->
{146} normal block at 0x0035B4B0, 40 bytes long.
 Data: <                > 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 
Object dump complete.
The program '[12412] ConsoleApplication1.exe' has exited with code 0 (0x0).

how can I know from that, that I have a memory leak (I didn't delete[] a on purpose), what's {146}, cleary I don't have 146 lines in this code. Thanx for all the help.
Read this:

http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx

Particular:
1
2
3
4
5
6
#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif  // _DEBUG 
This will show you the source of the memory leak. You need to put it at the top of each .cpp
Topic archived. No new replies allowed.