计算机工程与应用 ›› 2013, Vol. 49 ›› Issue (14): 56-59.

• 理论研究、研发设计 • 上一篇    下一篇

嵌入式软件内存泄露检测方法研究

张  鹏,杨秋辉,李海怒   

  1. 四川大学 计算机学院,成都 610065
  • 出版日期:2013-07-15 发布日期:2013-07-31

Research of memory leak detection method on embedded system

ZHANG Peng, YANG Qiuhui, LI Hainu   

  1. College of Computer Science, Sichuan University, Chengdu 610065, China
  • Online:2013-07-15 Published:2013-07-31

摘要: 动态内存分配为C/C++语言编程人员提供了极大的灵活性,但同时也带来了一个潜在的严重问题——内存泄露。与桌面系统相比,嵌入式系统处理能力弱、内存空间小、运行时间长,如果在程序运行期间发生内存泄露,将导致系统崩溃,造成不可预料的后果,因此需要在开发调试阶段尽早检测出造成内存泄露的代码。提出了一种基于动态检测技术和程序插装技术的嵌入式软件内存泄露分布式检测方法。该方法的实现思想是当程序在目标机运行时,插装代码自动截获内存操作函数,收集内存操作相关信息并把收集到的信息发送到服务器端处理,实现了嵌入式系统内存泄露的准确检测。实验结果证明,由于采用分布式技术进行信息处理,内存泄露检测效率得到了很大的提升。

关键词: 嵌入式软件, 内存泄露检测, 动态插装, 动态检测, 分布式检测

Abstract: Dynamic memory assignment brings a great deal of flexibility for the C/C++ programmers, but this poses a potentially serious problem-memory leak. Compared with desktop systems, embedded systems have weak processing capability, small memory space, long running time. If memory leak occurs during the execution of a program, it results in  unexpected consequences. Therefore, it is necessary to find the code which causes a memory leak as early as possible. In this paper, a distributed memory leak detection method for embedded software is presented which is based on dynamic detection techniques and program instrumentation technology. The main idea of this method is that when the program is running on the target machine, the instrumentation code automatically intercepts memory operation functions, collects memory operation information and sends the  information to the server. The experimental results show that the performance of memory leak detection has been greatly improved through the use of distributed processing technology.

Key words: embedded software, memory leak detection, dynamic instrumentation, dynamic detection, distributed detection