Professional Documents
Culture Documents
Detection of Precise C/C++ Memory Leakage by Diagnosing Heap Dumps Using Inter Procedural Flow Analysis Statistics
Detection of Precise C/C++ Memory Leakage by Diagnosing Heap Dumps Using Inter Procedural Flow Analysis Statistics
Poornima.spa@gmail.com
S.P. Anandaraj
guru_rao_cv@hotmail.com
I. INTRODUCTION
Memory leaks are challenging to identify
and debug for several reasons. First, the observed
failure may be far removed from the error that
caused it, requiring the use of heap analysis tools
that examine the state of the reachability graph
when a failure occurred [4]. Second, real-world
applications usually make heavy use of several
layers of frameworks whose implementation details
are unknown to the developers debugging
www.ijrcct.org
anandsofttech@gmail.com
Page 1041
Heap
www.ijrcct.org
fd
Stack
Low address
Uninitialized
data
Initialized
data
Text
Initialized by
zero by exec
Read from
program file
by exec
Page 1042
www.ijrcct.org
Page 1043
Fig.2 Representation of Compiling and Linking of heap dumps During Program Execution
1) Mismatched Allocation/Deallocation
www.ijrcct.org
Page 1044
int p;
int q=p*4;
www.ijrcct.org
Page 1045
#
LD_PRELOAD=/usr/lib/libtcmalloc.so.0.0.0
HEAPCHECK=normal ./your-program
When the program is linked and executed, it
generates a report about memory leaks identified.
The Command LD_PRELOAD links dynamically
the user program with libraries. This command
needs to be executed before compiling and
executing the user programs. For the purpose of
experimentation, the program is linked and
executed under various criterias.
While programs execution, the linked library used
the following environment variable, defined for
ensuring the memory levels:
Fig.3 Sample Generated Report for Identification of Heap memory Leak in user Program
www.ijrcct.org
Page 1046
ACKNOWLEDGEMENT
Authors would like to express sincere thanks to
Department of Science and Technology (New
Delhi) for their financial support to carry out this
work under project grant No. SR/WOS-A/ET24/2012.Further, their sincere feelings and
www.ijrcct.org
REFERENCES
[1]. D. L. Heine and M. S. Lam. A practical flowsensitive and context-sensitive C and C++
memory leak detector. In Proceedings of the
ACM SIGPLAN 2003 Conference on
Programming
Language
Design
and
Implementation (PLDI), pages 168181, Jun
2003.
[2]. P. Zhou, F. Qin, W. Liu, Y. Zhou, and J.
Torrellas. iWatcher: Efficient architecture
support
for
software
debugging.
In
Proceedings of the 31st International
Symposium on Computer Architecture (ISCA),
pages 224237, Jun 2004.
[3]. C++0x/C++11
Support
in
GCC.
http://gcc.gnu.org/onlinedocs/libstdc++/manual
/bk01pt04ch11.html (ref.19th May 2012).
[4]. David Drysdale. High-Quality Software
Engineering. Lulu.com, 2007. Mel Gorman.
Understanding the Linux Virtual Memory
Manager. Prentice Hall, 2004.
[5]. D.R. Chase, M. Wegman, and F. Zadeck.
Analysis of pointers and structures. In
SIGPLAN Conf. on Prog. Lang. Design and
Impl., pages 296{310, 1990.
[6]. N.D. Jones and S.S. Muchnick. Flow analysis
and optimization of Lisp-like structures.
in S.S. Muchnick and N.D. Jones, editors,
Program Flow Analysis: Theory and
Applications, chapter 4. Prentice-Hall,
Englewood Cli_s, NJ, 1981.
[7]. Abraham Silberschatz, Peter B. Galvin, and
Greg Gagne. Operating System Concepts.
Wiley, 2008.
[8]. Y. Xie and A. Chou. Path sensitive analysis
using boolean satis_ability. Technical report,
Stanford University, Nov. 2002.
[9]. D. Evans. Static detection of dynamic memory
errors. In Proceedings of the ACM SIGPLAN
1996 Conference on Programming Language
Design and Implementation, 1996.
[10].Y. Xie and A. Aiken. Scalable error detection
using boolean satis_ability. In Proceedings of
the 32nd Annual Symposium on Principles of
Programming Languages, Jan. 2005.
[11].D. Liang and M. Harrold. E_cient computation
of parameterized pointer information for
interprocedural analysis. In Proceedings of the
8th Static Analysis Symposium, 2001.
[12].T. Xie, S. Thummalapenta, D. Lo, and C. Liu.
Data Mining for Software Engineering. IEEE
Computer Vol. 42(8):3542, Aug 2009
[13].J. Engelfriet and G. Rozenberg. Graph
grammars based on node rewriting: an
introduction to nlc graph grammars. In Graph
Page 1047
www.ijrcct.org
Page 1048