Font Size: a A A

Dynamic Memory Leak Detection Based On The MSVL Compiler

Posted on:2018-05-22Degree:MasterType:Thesis
Country:ChinaCandidate:X HouFull Text:PDF
GTID:2348330521450903Subject:Computer software and theory
Abstract/Summary:PDF Full Text Request
With the development of computer science technology,the demand for computer applications is increasing and the quality of software becomes more and more important.How to effectively manage the memory and prevent leakage has become a prominent problem.Memory leak is a common system security problem.People generally do not feel the existence of memory leak.However,memory leak can lead to serious consequences for long-running large-scale software systems.With the accumulation of memory leaks,the overall performance of the program is degraded,and it may even lead to the termination of the program or computer crashes,which makes the detection of memory leaks necessary.The thesis first studies the knowledge of memory leak and detection techniques.Subsequently,the syntax and semantics of Modeling,Simulation and Verification Language(MSVL)is introduced.After that,the working principle of MSVL compiler is described,which includes the transformation from MSVL program into intermediate code IR of LLVM,and the generation of executable code.On the basis of MSVL compiler,the thesis designs and implements dynamic memory leak detection for MSVL programs.Memory information is obtained by dynamic instrumentation when the MSVL program is translated into its corresponding IR codes,which includes memory address,memory size,variable pointing to the memory block,function name,line number,and so on.Then the memory information is stored and managed by data structures.When memory allocation statements,assignment statements,memory release statements and functions are executed in the source code,related memory information will be updated.At the end of program execution,a corresponding data structure stores the final leakage information,including the total number of leaks,the number of lost memories,each memory leak information and line number information.Each leakage contains line number of the memory allocation statement,line number that the memory block is last used in the source code,and line number which causes the leakage.The user can track the usage of each memory block and the execution path of the relevant statement by the line number,which makes it convenient to analyze and modify the program.Finally,the functional tests and practical application tests are carried out.The experimental results show that dynamic memory leak detection based on the MSVL compiler performs well in terms of practicality,reliability and maintenance.Compared with the Memory Validator,the leakage information provided by our tool is more comprehensive.
Keywords/Search Tags:memory leak, MSVL, IR, dynamic instrumentation, lost memory
PDF Full Text Request
Related items