【24h】

A Practical Flow-Sensitive and Context-Sensitive C and C++ Memory Leak Detector

机译:实用的流量敏感和上下文敏感的C和C ++内存泄漏检测器

获取原文
获取原文并翻译 | 示例

摘要

This paper presents a static analysis tool that can automatically find memory leaks and deletions of dangling pointers in large C and C++ applications. We have developed a type system to formalize a practical ownership model of memory management. In this model, every object is pointed to by one and only one owning pointer, which holds the exclusive right and obligation to either delete the object or to transfer the right to another owning pointer. In addition, a pointer-typed class member field is required to either always or never own its pointee at public method boundaries. Programs satisfying this model do not leak memory or delete the same object more than once. We have also developed a flow-sensitive and context-sensitive algorithm to automatically infer the likely ownership interfaces of methods in a program. It identifies statements inconsistent with the model as sources of potential leaks or double deletes. The algorithm is sound with respect to a large subset of the C and C++ language in that it will report all possible errors. It is also practical and useful as it identifies those warnings likely to correspond to errors and helps the user understand the reported errors by showing them the assumed method interfaces. Our techniques are validated with an implementation of a tool we call Clouseau. We applied Clouseau to a suite of applications: two web servers, a chat client, secure shell tools, executable object manipulation tools, and a compiler. The tool found a total of 134 serious memory errors in these applications. The tool analyzes over 50K lines of C++ code in about 9 minutes on a 2 GHz Pentium 4 machine and over 70K lines of C code in just over a minute.
机译:本文介绍了一种静态分析工具,该工具可以在大型C和C ++应用程序中自动查找内存泄漏和悬挂指针的删除。我们已经开发了一种类型系统,以规范化内存管理的实际所有权模型。在此模型中,每个对象都由一个且只有一个拥有者指针指向,该指针拥有排他的权利和义务,即删除对象或将权利转移给另一个拥有者指针。此外,要求指针类型的类成员字段在公共方法边界处始终拥有或永远不拥有其指针。满足此模型的程序不会泄漏内存或删除同一对象多次。我们还开发了一种流敏感和上下文敏感的算法,以自动推断程序中方法的可能所有权接口。它会将与模型不一致的语句标识为潜在泄漏或重复删除的来源。该算法相对于C和C ++语言的较大子集而言是合理的,因为它将报告所有可能的错误。它也很实用和有用,因为它可以识别可能与错误相对应的警告,并通过向用户显示假定的方法界面来帮助他们了解所报告的错误。我们的技术已通过称为Clouseau的工具的实现得到验证。我们将Clouseau应用到了一套应用程序:两个Web服务器,一个聊天客户端,安全外壳工具,可执行对象操作工具和一个编译器。该工具在这些应用程序中共发现134个严重的内存错误。该工具在2 GHz Pentium 4机器上约9分钟内分析了超过5万行C ++代码,而在一分钟内分析了超过70K行C代码。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号