高级检索

    基于局部堆内存抽象表示的堆操作程序内存泄露检测

    Memory Leak Detection for Heap-Manipulating Programs Based on Local Heap Abstraction

    • 摘要: 堆操作程序通过共享易变数据结构可灵活地申请、合并、删除堆内存.这类程序的内存泄漏检测要求精确的域敏感的指针别名信息,变得尤其复杂和难以处理.针对这个问题,提出了基于“指针扩展类型”域敏感的堆内存抽象方法,对指针变量在形态上的排列关系进行抽象以支持堆的局部推理.首先,定义了各种基本语句的操作语义,然后基于该抽象方法采用前向数据流迭代算法提出了一种新的内存泄露检测算法.在Crystal编译框架下实现了面向C程序的内存泄漏检测原型工具Heapcheck,该工具支持复杂数据结构内指针型数据域上的内存泄露检测.在典型基准C程序上的实验结果分析表明,该方法与现有的技术相比在效率和精度上都具有优势.

       

      Abstract: There are many operations about shared and mutable data structures in heap-manipulating programs, such as allocation, combination, separation, deletion, and so on. Therefore, memory leak detection for these programs requires precise field-sensitive pointer alias information, which becomes more complex and harder to deal with. A novel field-sensitive heap abstraction approach based on extended pointer types is proposed for heap-manipulating programs in this paper. The approach computes the local layout around pointer variables in the heap, and therefore supports local reasoning for heap. The pointer alias sets are computed about the memory cells, which are reached by the pointer along various pointer fields in the given abstract distance domain. Various operation semantics about all basic statements based on extended pointer types are defined and a new algorithm runs typical forward dataflow iteration analysis to see whether there are any memory leaks. Our algorithm also supports both intra- and inter- procedural analysis. We have implemented the prototype tool (Heapcheck) for C programs in the Crystal open compiler framework to support detecting memory leaks about different pointer fields in complex data structures. Experimental evaluation about a set of C benchmark programs shows that the proposed approach has better scalability and precision than current work.

       

    /

    返回文章
    返回