摘要: 针对可执行文件的动态内存管理容易产生的错误,设计并实现了一个Linux 平台下针对C/C++语言的动态内存检测模块DDMEM,使用自定义的ddmemMalloc()函数改写动态分配函数malloc(),实现了一个共享库ddmem.so,可以检测内存泄漏、内存写溢出、释放野指针和内存管理函数的不匹配等问题。给出了函数不匹配的实例检测以验证方法的有效性。并与同类有代表性的检测工具memwatch进行了性能比较,证明该检测模块比memwatch整体更优。
关键词:
动态内存检测,
函数不匹配,
内存泄漏,
写溢出,
野指针
Abstract: A dynamic memory detection module DDMEM for C/C++ languages on Linux platform is designed to solve the errors of dynamic memory management. The malloc() dynamic distribution function is replaced by customized ddmemMalloc(). And a share library DDMEM is achieved. The module can detect memory leak, write overflow, free wild pointer and mismatch using of memory functions of the executable files. Finally, an instance to test functions mismatch and comparing between the DDMEM and a representational test tool Memwatch is carried to validate the effectiveness of method and module.
Key words:
Dynamic memory check,
Functions mismatch,
Memory leak,
Write overflow,
Wild pointer
高海昌;冯博琴;卫 鹏;何杭军. Linux下可执行文件的动态内存检测设计与实现[J]. 计算机工程, 2007, 33(01): 74-76.
GAO Haichang; FENG Boqin; WEI Peng; HE Hangjun. Design and Implementation of Executable Files Dynamic Memory Test Tool on Linux NC Platform[J]. Computer Engineering, 2007, 33(01): 74-76.