Knight's Tale
搜索
RESUME
WordLife
联系
Knight's Tale
»
技术
Some bad C++ programming habits which may lead to Memory Leak Error
2010-06-07 22:56
There are some bad programming habits in my experience which can lead to Memory Leak:
Use inherit class structure. But you never writing virtual destructions method for your base class.
use "new" to create one object, but forgetting to write "delete" statement for this object. ( This bad codes can be detected by some tricks:
http://www.liaoqiqi.com/blog/2010/06/01/how-to-make-memory-leak-detection-in-c/comment-page-1/#comment-218
)
create an array objects, but use "delete" instead of " delete []" to destory the array objects.
To be continued....
本文链接地址:
Some bad C++ programming habits which may lead to Memory Leak Error