You are here:

C++/Memory Leak

Advertisement


Question
Hi!
Joydeep will you please tell me that What is meant by memory leak and when it occur also Give me a simple practical example about this.
Thanks

Answer
Hi Sofia

Unintentional memory consumption by a computer program where the program fails to release memory when no longer needed.

Suppose you have allocated some memory using new(in C++) or malloc/calloc (in C) and you have not deallocated the memory after using it so the memory is not returned back to the heap. For bigger projects where you need lot of memory it may cause scarcity of space when you have plenty of deallocated or unused space in your hand so this might lead to a program crash where it wouldn't have crashed if you would have returned those memory properly to the heap. It is as if the memory is "leaked out" of the program this is called memory leak.

In case if you still have doubts regarding memory leaks please feel free to get back to me.

regards
Joydeep Bhattacharya
http://www.scodz.com

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Joydeep Bhattacharya

Expertise

TSR, Socket and Very Complex Mathematical Problem

Experience

Worked on many OOP projects with design patterns

Organizations
http://www.scodz.com

Publications
http://www.scodz.com

Education/Credentials
Master of Computer Applications

Awards and Honors
Being a proud owner of a website of programming called http://www.scodz.com

Past/Present Clients
http://www.funforu.com http://www.dhoondho.com http://analysingc.50webs.com

©2016 About.com. All rights reserved.