c++
penguin_vip
生命不息,折腾不止
展开
-
C++ 11 smart ptr
template<typename T>class SharedPtr{public: SharedPtr(T* ptr=NULL) { _ptr=ptr; _refCount=new long(1); } ~SharedPtr() { _Release(); } Sha...原创 2018-07-17 19:10:12 · 347 阅读 · 0 评论 -
list+shared—prt+new
#include <iostream>#include <list>#include <memory>using namespace std;class Test{public: Test(int i) { m_count = i; cout << "Test()" << e...原创 2018-07-20 19:11:29 · 184 阅读 · 0 评论 -
VLD(Visual LeakDetector)内存泄露检测(QT+VS2015+VLD2.5.1)
1. 原理:这篇文章讲清楚了:https://wenku.baidu.com/view/543cd4e8e87101f69f31956c.html VLD工具原理下面我们来看看VLD是如何工作的。在VisualC++中内置工具CRT Debug Heap工具,在使用Debug版本分配内存时,它会在内存块中记录分配该内存的文件名和行号。当程序退出时CRT会在main函数返回时做一...原创 2018-10-15 00:40:35 · 1808 阅读 · 0 评论