摘要
内存泄漏在没有垃圾回收机制的语言中是常见的问题,虽然Fortran95引入ALLOCATABLE数组解决了部分泄漏问题,但是通过指针申请内存资源仍然会造成泄漏,现有研究对Fortran内存泄漏的检测流程适配度不高且面向Fortran内存状态分析的效率和精确度上仍存在优化空间.针对这一问题,本文提出了一种面向Fortran指针引发的内存泄漏静态检测方法.首先引入指针引用控制流图(PR-CFG,Pointer Reference-Control Flow Graph)来精简程序模型,并符号化程序节点的内存状态信息,依据数据流生成路径敏感的符号化函数摘要作用于过程间分析,最终通过PR-CFG节点上由抽象内存状态计算得到的内存状态集进行故障模式状态机的状态转化来实现内存泄漏的检测.实验表明,本方法提高了Fortran指针引发内存泄漏的检测精度和效率,降低了检测的误报率.
Memory leak is a common problem in languages without garbage collection mechanisms.Although Fortran95 introduced ALLOCATABLE arrays to solve some of the leaks,applying for memory resources through pointers will still cause leaks.Existing research is not well adapted to the detection process of Fortran memory leaks,and there is still room for optimization in terms of efficiency and accuracy of Fortran memory state analysis.To solve this problem,this paper proposes a static detection method for memory leaks caused by pointers in Fortran programs.Firstly,the Pointer Reference-Control Flow Graph(PR-CFG)is introduced to simplify the program model,and symbolize the memory state information of program nodes,and generate a path-sensitive symbolic function summary based on the data flow for inter-procedural analysis,and performs the state transition of the fault mode state machine according to the memory state set obtained by the abstract memory state calculation on the node of the PR-CFG graph to realize the detection of memory leaks.Experiments show that this method improves the detection accuracy and efficiency of memory leaks caused by Fortran pointers,and reduces the false positive rate of detection.
作者
罗坤
金大海
宫云战
LUO Kun;JIN Dahai;GONG Yunzhan(State Key Laboratory of Networking and Switching Technology,Beijing University of Posts and Telecommunication,Beijing 100876,China)
出处
《小型微型计算机系统》
CSCD
北大核心
2024年第7期1778-1786,共9页
Journal of Chinese Computer Systems
基金
国家自然科学基金项目(U1736110)资助.