作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2007, Vol. 33 ›› Issue (01): 74-76. doi: 10.3969/j.issn.1000-3428.2007.01.025

• 软件技术与数据库 • 上一篇    下一篇

Linux下可执行文件的动态内存检测设计与实现

高海昌1,冯博琴1,卫 鹏2,何杭军2   

  1. (1. 西安交通大学电子与信息工程学院,西安 710049;2. 西安交通大学软件学院,西安 710049)
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2007-01-05 发布日期:2007-01-05

Design and Implementation of Executable Files Dynamic Memory Test Tool on Linux NC Platform

GAO Haichang1, FENG Boqin1, WEI Peng2, HE Hangjun2   

  1. (1. School of Electronics and Information Engineering, Xi’an Jiaotong University, Xi’an 710049;
    2. School of Software, Xi’an Jiaotong University, Xi’an 710049)
  • Received:1900-01-01 Revised:1900-01-01 Online:2007-01-05 Published:2007-01-05

摘要: 针对可执行文件的动态内存管理容易产生的错误,设计并实现了一个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