Like i asked before, This thread is about Memory Leak.
I am a beginner in c++ and want to become a senior programmer. When i was coding, i found the memory leak is happening everywhere and maybe some senior programmer also have this problem.
So i want to start a thread, let's talk about the memory leak. And throw some examples if you want.
Let me begin first:
Pointer assignment memory leak:
char *a= new char; char *b=new char; b=a; deleteb;
In fact, this pointer assignment free the dynamic variable associated with pointer a. It will never free b.
So this is my example. You guys could give your example.
I know there have a bunch of articles about this topic. But since there have a lot of expert here, so i was thinking maybe we could learn more from here.