# [C++]Check memory leak with Task Manangement

## Recommended Posts

smallGame    211
Hi, I proccess the following program and I commented the program size (in KB) given by the Windows Task Management. I was wondering why a such behaviour in C++, it looks like to be a Java behaviour with his Garbage Collector. Any answer will be appreciated it.
       char *a, *b, *c, *d, *e, f;

cin>>f; //284 KO

a = new char[2048];
b = new char[2048];
c = new char[2048];
d = new char[2048];
e = new char[2048];

cin>>f; // 296 KO

delete[] a;
delete[] b;
delete[] c;
delete[] d;
delete[] e;

cin>>f; // 296 KO



##### Share on other sites
rip-off    10979
The Task Manager doesn't give the complete picture. It is not a reliable source.

C++ isn't garbage collected. More likely that some component (such as the allocator in the runtime, or perhaps the OS) is caching that memory, anticipating that you will request more. This is quite normal.

smallGame    211
Ok thanks a lot.