Jump to content
  • Advertisement
Sign in to follow this  
smallGame

[C++]Check memory leak with Task Manangement

This topic is 3617 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!