天佐.炼妖壶带内存泄漏检测的内存池
- 游戏开发
 - 2025-09-11 17:42:02
 

天佐.炼妖壶 天佐.炼妖壶 简介
天佐.炼妖壶 一种简单的内存池,初始化申请一些内存循环使用,不够时动态进行扩容,并且带内存泄漏检测功能。
传说: 它代表着融合和进化。炼妖壶可以收纳万物,将妖兽、灵兽等生物炼化为壶中元气。这种力量象征着融合与进化,寓意着道家文化的包容与和谐。
目标设计一种内存池,循环进行内存使用,提高内存使用效率,同时提供内存泄漏检测功能。
功能 🧩 集成简单📝 可选择生成内存泄漏日志🪐 日志多语言(简体中文/English) 截图通过日志分析定位内存泄漏代码行:
例子 #include <iostream> #include "../../include/tianzuo.LianYaoInterface.h" void* operator new(size_t size) { return tianzuo_LianYaoInt::mem_get(size); } void* operator new[](size_t size) { return operator new(size); } void operator delete(void* ptr) noexcept { tianzuo_LianYaoInt::mem_del(ptr); } void operator delete[](void* ptr) noexcept { operator delete(ptr); } class cpp { public: cpp() {} ~cpp() {} private: int m_a; long m_l; float m_f; }; int main(int argc, char* argv[]) { std::cout << "start tianzuo.LianYaoTest ...\n"; #ifdef WIN32 tianzuo_LianYaoInt::initialize(3, "memory_leaks.log", nullptr, 0); #else tianzuo_LianYaoInt::initialize(3, "memory_leaks.log", "./tianzuo.LianYaoTest", 0); #endif int* new_int = new int(10); // leak 4 int* new_int2 = new int(10); *new_int2 = 12; for (size_t i = 0; i < 10; i++) { int* new_int3 = new int(10); *new_int3 = 12; delete new_int3; } char* new_buf = new char[1555]; // leak 1555 char* new_buf2 = new char[123]; cpp* new_class = new cpp(); // leak 12 cpp* new_class2 = new cpp(); class1* cls1 = new class1(); delete cls1; delete new_class2; delete new_int2; delete[] new_buf2; tianzuo_LianYaoInt::terminate(); return 0; } 下载 github /zhengtianzuo/tianzuo.LianYao/releases gitee /zhengtianzuo/tianzuo.LianYao/releases pan.baidu /s/1Lv9dOBpV4-eXpi9yl0BSUg?pwd=1234 share.weiyun /J7ZYxKL7 作者郑天佐邮箱zhengtianzuo06@163 主页http:// .zhengtianzuo github github /zhengtianzuo天佐.炼妖壶带内存泄漏检测的内存池由讯客互联游戏开发栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“天佐.炼妖壶带内存泄漏检测的内存池”