I J C S I E International Science Press

Similar documents
Tolerating Memory Leaks

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley

Managed runtimes & garbage collection

Greater complexity & reliance

Garbage Collection Algorithms. Ganesh Bikshandi

Run-Time Environments/Garbage Collection

CSE P 501 Compilers. Memory Management and Garbage Collec<on Hal Perkins Winter UW CSE P 501 Winter 2016 W-1

Lecture 15 Garbage Collection

Garbage Collection. Hwansoo Han

Runtime. The optimized program is ready to run What sorts of facilities are available at runtime

Performance of Non-Moving Garbage Collectors. Hans-J. Boehm HP Labs

Programming Language Implementation

Implementation Garbage Collection

Exploiting the Behavior of Generational Garbage Collector

CS 4120 Lecture 37 Memory Management 28 November 2011 Lecturer: Andrew Myers

CMSC 330: Organization of Programming Languages

Lecture 13: Garbage Collection

Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java)

CMSC 330: Organization of Programming Languages

Heap Compression for Memory-Constrained Java

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides

Garbage Collection Techniques

One-Slide Summary. Lecture Outine. Automatic Memory Management #1. Why Automatic Memory Management? Garbage Collection.

Lecture Notes on Garbage Collection

Autonomous Garbage Collection: Resolve Memory

Dynamic Storage Allocation

Garbage Collection. Akim D le, Etienne Renault, Roland Levillain. May 15, CCMP2 Garbage Collection May 15, / 35

Deallocation Mechanisms. User-controlled Deallocation. Automatic Garbage Collection

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection

Garbage Collection (2) Advanced Operating Systems Lecture 9

Garbage Collection (1)

Run-time Environments -Part 3

Heap Management. Heap Allocation

Automatic Memory Management

Algorithms for Dynamic Memory Management (236780) Lecture 4. Lecturer: Erez Petrank

JamaicaVM Java for Embedded Realtime Systems

ACM Trivia Bowl. Thursday April 3 rd (two days from now) 7pm OLS 001 Snacks and drinks provided All are welcome! I will be there.

Habanero Extreme Scale Software Research Project

Efficient Garbage Collection for Large Object-Oriented Databases

Myths and Realities: The Performance Impact of Garbage Collection

Robust Memory Management Schemes

Compiler Construction

Automatic Garbage Collection

Leak Pruning. 1. Introduction. Abstract. Department of Computer Sciences The University of Texas at Austin

Compilers. 8. Run-time Support. Laszlo Böszörmenyi Compilers Run-time - 1

G Programming Languages - Fall 2012

Glacier: A Garbage Collection Simulation System

Garbage Collection. Weiyuan Li

MEMORY MANAGEMENT HEAP, STACK AND GARBAGE COLLECTION

Compiler Construction

High-Level Language VMs

Lecture Notes on Garbage Collection

6.172 Performance Engineering of Software Systems Spring Lecture 9. P after. Figure 1: A diagram of the stack (Image by MIT OpenCourseWare.

Short-term Memory for Self-collecting Mutators. Martin Aigner, Andreas Haas, Christoph Kirsch, Ana Sokolova Universität Salzburg

Bugs in Deployed Software

CSE 307: Principles of Programming Languages

Opera&ng Systems CMPSCI 377 Garbage Collec&on. Emery Berger and Mark Corner University of Massachuse9s Amherst

Compiler Construction D7011E

Manual Allocation. CS 1622: Garbage Collection. Example 1. Memory Leaks. Example 3. Example 2 11/26/2012. Jonathan Misurda

Quantifying the Performance of Garbage Collection vs. Explicit Memory Management

Space Efficient Conservative Garbage Collection

Binding and Storage. COMP 524: Programming Language Concepts Björn B. Brandenburg. The University of North Carolina at Chapel Hill

A First Implementation of the DMOS Garbage Collector John N. Zigman è

arxiv:cs/ v1 [cs.dc] 10 Jul 2002

Programming Languages Third Edition. Chapter 7 Basic Semantics

Stack Tracing In A Statically Typed Language

Name, Scope, and Binding. Outline [1]

Reference Counting. Reference counting: a way to know whether a record has other users

Mark-Sweep and Mark-Compact GC

Lecture 15 Advanced Garbage Collection

Programming Languages Third Edition. Chapter 10 Control II Procedures and Environments

Design Issues. Subroutines and Control Abstraction. Subroutines and Control Abstraction. CSC 4101: Programming Languages 1. Textbook, Chapter 8

Lecture 21: Logging Schemes /645 Database Systems (Fall 2017) Carnegie Mellon University Prof. Andy Pavlo

CS 345. Garbage Collection. Vitaly Shmatikov. slide 1

A new Mono GC. Paolo Molaro October 25, 2006

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder

JOURNALING FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 26

Azul Pauseless Garbage Collection

Garbage Collection. Steven R. Bagley

Honours/Master/PhD Thesis Projects Supervised by Dr. Yulei Sui

Towards Garbage Collection Modeling

TECHNOLOGY WHITE PAPER. Azul Pauseless Garbage Collection. Providing continuous, pauseless operation for Java applications

Using the Singularity Research Development Kit

C. E. McDowell August 25, Baskin Center for. University of California, Santa Cruz. Santa Cruz, CA USA. abstract

Hierarchical PLABs, CLABs, TLABs in Hotspot

CS 241 Honors Memory

Structure of Programming Languages Lecture 10

Last Class Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

Project. there are a couple of 3 person teams. a new drop with new type checking is coming. regroup or see me or forever hold your peace

The C4 Collector. Or: the Application memory wall will remain until compaction is solved. Gil Tene Balaji Iyengar Michael Wolf

Generation scavenging: A non-disruptive high-performance storage reclamation algorithm By David Ungar

Simple Garbage Collection and Fast Allocation Andrew W. Appel

Systems software design. Software build configurations; Debugging, profiling & Quality Assurance tools

:.NET Won t Slow You Down

Advanced Programming & C++ Language

Memory Management. Memory Management... Memory Management... Interface to Dynamic allocation

Reference Counting. Reference counting: a way to know whether a record has other users

Program Analysis. Uday Khedker. ( uday) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay

Memory Leak Detection with Context Awareness

Transcription:

Vol. 5, No. 2, December 2014, pp. 53-56 I J C S I E International Science Press Tolerating Memory Leaks at Runtime JITENDER SINGH YADAV, MOHIT YADAV, KIRTI AZAD AND JANPREET SINGH JOLLY CSE B-tech 4th Year, Dronacharya College of Engineering Abstract: Type safety and garbage collection in driven languages wipes out memory errors such as dangling pointers, double frees, and leaks of unreachable objects. Unfortunately, a program still leaks memory if it continue references to objects it will not at all use again. Leaked objects decrease program locale and increase exhaust memory and crash the program. This paper introduces leak tolerance approaches called Melt and LeakSurviver, that safely eliminates performance degradations and crashes due to leaks of dead but reachable objects in managed languages, given efficient disk space to hold leaking objects. Melt (1) identifies stale objects that the program is not accessing; (2) segregates in use and stale objects by storing stale objects to disk; and (3) preserves safety by activating stale objects if the program subsequently accesses them. We design and build a prototype implementation of Melt in a Java VM and show it adds overhead low enough for production systems. Whereas existing VMs grind to a halt and then crash on programs with leaks, Melt keeps many of these programs running much longer without significantly degrading performance. Melt provides users the illusion of a fixed leak and gives developers more time to fix leaky programs. Leak-Surviver is handled in three ways which are discussed in the context. Keywords: Garbage Collection. Dangling Pointers. Melt. Stale Objects. Leak-Survivor. 1. INTRODUCTION Garbage-collected languages such as Java and C# become increasingly popular. This is partly because programs written in these languages are free of many types of memory errors, which are notorious for compromising system availability and security. For example, by forbidding explicit pointers, Java programs do not encounter memory corruptions due to incorrect pointer- arithmetics. With tremendous advances of hardware and Just-In-Time (JIT) compiler techniques, garbage collected languages are now applied even in enterprise server environments. Unfortunately, memory leaks still exist and severely affect performance and availability for garbage collected programs, even though garbage collectors can reclaim unreachable memory objects. Memory leaks occur in a garbage-collected program when the program keeps references to memory objects that are no longer needed. As a result, the heap space occupied by leaked memory objects cannot be reclaimed by garbage collectors. For long-running garbage-collected programs, continuously-leaked memory objects take up more and more space in the heap, leading to more frequent invocation of garbage collections (GC) at runtime. Additionally, more leaked objects in the heap space increase the object traversal time during each GC phase. Therefore, continuous memory leaks cumulatively degrade overall program performance. Even worse, memory leaks may exhaust system resources, eventually causing program crashes. Therefore, it is imperative to devise mechanisms for tolerating continuous memory leaks at runtime for garbage-collected programs. The mechanisms must enable programs to maintain relatively stable performance and survive software failures caused by continuous memory leaks. This paper presents two leak tolerance approaches called Leak-Survivor and Melt. 2. LEAK TOLERANCE APPROACHES Leaks are especially hard to reproduce, find, and fix since they have no immediate symptoms. 2.1. Leak Tolerance with Melt Melt s primary objective is to give the illusion there is no leak: performance does not degrade as the leak

54 M. TAMIL THENDRAL, C. JOTHI PERUMAL AND K. KAVITHADEVI grows, the program does not crash, and it runs correctly. Stale objects are isolated from the in-use objects in a separate stale space, which resides on disk. The collector never accesses objects in the stale space, except when moving objects to the stale space. The application never accesses objects in the stale space, except when activating objects from the stale space. We classify reachable objects that the program has not referenced in a while as stale. If the program never accesses them again, they are true leaks. To identify stale objects, Melt requires modifications to both the garbage collector and the dynamic compiler. Ata high level, the modified collector marks objects as stale on each collection, and the modified compiler adds instrumentation to the application to unmark objects at each use. The compiler adds instrumentation called a conditional read barrier [8] to every load of an object reference. The barrier checks whether the reference is stale. If it is stale, the barrier un marks the referenced object and the reference. The following pseudo code shows the barrier: b = a.f; if (b & 0x1) // Application code { // Conditional barrier t = b; b &= ~0x1; a.f = b; [iff a.f == t] b.staleheaderbit = 0x0; } // Backup ref // Unmark ref // Atomic store // Unmark object 2.1.3. Activating Stale Objects Melt prevents the application from directly accessing the stale space since (1) these accesses would violate the invariant that the stale space is not part of the application s working set, and (2) object references in the stale space may refer to stubs and scions. Melt intercepts application access to stale objects by modifying the read barrier to check for references to the stale space b = a.f; if (b & 0x1) { t = b; b &= ~0x1; if (instalespace(b)) { b = activatestaleobject(b); } a.f = b; [iff a.f == t] b.staleheaderbit = 0x0;} // Application code // Read barrier // Check if in stale space 2.2. Leak Tolerance with Leaksurvivor It can avoid cumulative performance degradation and software failures due to continuous memory leaks. In addition, it helps developers to prune false positives. 2.2.1. Components LeakSurvivor consists of three major components that detect and tolerate memory leaks during program execution. This conditional barrier reduces overhead since it performs stores only the first time the application loads each reference in each mutator epoch (the mutator is the application alone not the collector). Checking for a marked reference, rather than a marked object, reduces overhead since it avoids an extra memory load. 2.1.2. The Stale Space When the garbage collection traces the heap, it now also moves stale objects to the stale space, which resides on disk. Stub-scion pairs. References from stale objects to in-use objects are problematic because moving collectors such as copying and compacting collectors move in-use objects. Figure 1: LeakSurvivor Architecture

WIRELESS BASED HUMAN HEALTCARE MONITORING SYSTEM 55 2.2.1.1. Leak Detectors: Leak detectors identify PL memory objects and pass this information to the swapout component. For garbage collected programs, memory objects that are unreachable from roots. 2.2.1.2. Swap-out Component: The swap-out component saves the PL objects at runtime so that the virtual memory space occupied by them can be safely reclaimed by garbage collectors and are available for future memory requests. More specially, after PL objects are identified by leak detectors, the swap-out component copies their content from the virtual memory to the leak space. Figure 3: Swap-in Table and Incoming References Figure 2: Swap-out Table and Outgoing References In addition, the swap-out component assigns all the incoming references to each PL object with a unique reserved address that is not allowed to be de referenced at the user level. For all the outgoing references from each PL object, the swap-out component uses a swapout table to record such information for facilitating future garbage collections. 2.2.1.3. Swap-in Component: To handle an OS exception due to de-referencing a reserved address, the swap- in component first identifies the target PL object, allocates virtual memory space for the PL object, copies its content from leak space to the memory, and restores its incoming and outgoing references. Additionally, the swap-in component notifies the leak detectors of the falsely-identified PL object. After this, the program automatically retries the faulty instruction and continues the execution correctly. 3. FUTURE ASPECTS We plan to extend our work in several dimensions in the future. First, we will evaluate LeakSurvivor using more applications with memory leaks. We currently only have three applications since it is difficult to find real-world applications with well-documented memory leaks. Second, we plan to support LeakSurvivor with asynchronous disk flushes and derived pointers. Third, we will investigate the idea of LeakSurvivor for tolerating memory leaks in C/C++ programs, which is difficult since there is no type information at the binary level. 4. CONCLUSION Garbage collection and type safety save programmers from many memory bugs, but dead, reachable objects hurt performance and crash programs. Given enough disk space, our leak tolerance approach keeps programs from slowing down and running out of memory. Melt requires only time and space proportional to in-use memory, rather than leaked memory, and preserves safety by activating stale objects on disk that the program later references. Our Melt implementation adds low enough overhead for deployed use. For growing leaks in real programs, Melt substantially delays crashes due to out-of-memory errors. With plenty of disk space, Melt has the potential to improve the user experience. It buys developers more time to fix leaks and keeps users happy by providing the illusion there is no leak. These attributes make Melt a compelling feature for future production VMs.

56 M. TAMIL THENDRAL, C. JOTHI PERUMAL AND K. KAVITHADEVI In summary, LeakSurvivor is a safe and noninvasive method to tolerate continuous memory leaks at runtime for garbage-collected programs. It helps programs to avoid cumulative performance degradation and software failures due to continuous memory leaks. It does so by swapping out potentially-leaked memory objects to disks and reclaiming virtual memory space occupied by them. LeakSurvivor is safe because it swaps in the swapped-out objects to the memory upon future accesses to them if they are falsely identified as leaks. Additionally, LeakSurvivor assists developers to diagnose memory leaks by providing false positives information due to swapped-in objects. Furthermore, it requires no modification to applications source code. This indicates that safely reclaiming virtual memory space occupied by potentially-leaked objects is an effective way to leaks. In addition, LeakSurvivor improves the performance of programs with continuous memory leaks by 24%.46%. REFERENCES [1] Yan Tang, Qi Gao, and Feng Qin. [2] The Ohio State University ftangya, gaoq, qing@cse.ohiostate.edu [3] Department of Computer Sciences, the University of Texas at Austin. [4] E. Moss, and R. Hudson. Compiler Support for Garbage Collection in a Statically Typed Language. In ACM Conf. on Programming Language Design and Implementation (PLDI 92), June 1992. [5] Sun Developer Network Forum. Reflections & Reference. [6] Objects -Java memory leak example, 2003. (http://forum.- java.sun.com/thread.jspa?threadid=456545.) [7] http://java.dzone.com/articles/plumbr-30-evolutionaryjava-leak [8] h t t p s : / / f o r u m s. o r a c l e. c o m / t h re a d / 11 5 7 4 9 9? start=0&tstart=0 [9] create/avoid memory leak in Java by Venkat Subramaniam ( w w w. a g i l e d e v e l o p e r. c o m / a r t i c l e s / MemoryLeak092002.pdf) [10] http://www.ibm.com/developerworks/library/j-leaks/