Copyright @ Joel Jiang(江东敏) at 2017.09.16 21:00 p.m
in Shenzhen.China. LIST- TE- E11 -05
And some picture refer from the internet.
1.Avoid memory leak.
Make a attention of the "malloc/free" and "new/delete" usage.
1> Normal usage, leak one of them:
2> In the abnormal condition, for the "try../ catch..." :
2.Avoid the wild pointer.
"Wild" pointer is not aqual to the "NULL" pointer, means that "if(NULL == P)" can't be a situation for before the process in a function. There is some case as follow:
Note: P is pointer.
1> When the P is free or delete and don't be set as "NULL" .Actually the P will be a wild P, because when we delete P in this operation, deleting operation is delete the memory that the pointer point to ,rather than the P. eventually the P will be the wild pointer if you set it to "NULL".
2> Forget init the point variable when it be structured.
3.Don't return the local variable.
4.More use the "if(NULL == P)" when apply memory and the function parameter.
The sharing of knowledge, the spirit of encouragement.
By Joel Jiang (江东敏)