2005年3月26日

使用Singleton需要考虑内存释放

摘要: GoF[p84]所说的Singleton没有考虑到内存的释放解决方法:1、加入一个成员函数DestroyInstance()来释放内存,在整个工程中需且仅需调用DestroyInstance()一次。2、ME中说用智能指针 阅读全文

posted @ 2005-03-26 15:26 张大大123 阅读(100) 评论(0) 推荐(0) 编辑

std::oststream VS std::ostringstream

摘要: 用如下程序段在for循环中分别测试std::oststream 和 std::ostringstream,可以发现std::oststream 有内存泄露,最好使用std::ostringstream。 std::ostringstream oss, oss2; std::string ... 阅读全文

posted @ 2005-03-26 15:13 张大大123 阅读(138) 评论(0) 推荐(0) 编辑

导航