Transcript

Low-Overhead Memory Leak Detection Using Adaptive Statistical Profiling

ZHANG Hansheng1 Nov 2013

β€’ In Proceedings of the 11th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS 2004)

β€’ Trishul M. Chilimbi, Microsoft Research, One Microsoft Way, Redmond, WA

β€’ Matthias Hauswirth, University of Colorado at Boulder , Boulder, CO

About the Paper

Arnold-Ryder framework

startup:nCheck = nCheck0If nCheck > 0 run checking code decrease nCheckelse run instrumented code nCheck = nCheck0

π‘ π‘Žπ‘šπ‘π‘™π‘–π‘›π‘”π‘Ÿπ‘Žπ‘‘π‘’=1

h𝑛𝐢 π‘’π‘π‘˜0+1

Bursty Tracing

startup: nCheck = nCheck0 nInstr = 0If nCheck > 0 run checking code decrease nCheck if nCheck=0 nInstr=nInstr0if nInstr>0 run instrumented code decreate nInstr if nInstr=0 nCheck=nCheck0

π‘ π‘Žπ‘šπ‘π‘™π‘–π‘›π‘”π‘Ÿπ‘Žπ‘‘π‘’=π‘›πΌπ‘›π‘ π‘‘π‘Ÿ 0

h𝑛𝐢 π‘’π‘π‘˜0+π‘›πΌπ‘›π‘ π‘‘π‘Ÿ 0

β€’ sampling rate of frequently executed code decrease quickly until reaching a lower bound

β€’ ABT is used to trace frequent events (memory access)

β€’ Infrequent events (memory allocations) are fully traced

Adaptive Bursty Tracing (ABT)

β€’ Requirementsβ€’ AllocateObject(ip, startAddress, size)

β€’ FreeObject(ip, startAddress)

β€’ FindObject(ip, addresss)

β€’ GetObjectIterator

β€’ Implementationsβ€’ Hash table (address->objectInfo)

β€’ Hash table (startAddress->objectInfo)β€’ Hash table (address->offsetToStartAddress)

β€’ Address tree

Heap Model

0

0

0

0

0

0 00

0 0 0 0 0 0 0

0000 10000100 1100

1

1

1

1

1

1 11

1 1 1 1 1 1 1

Address: 0101

0101

Heap Model

Slides showing heap model are copied from: http://research.microsoft.com/en-us/um/people/trishulc/swatpresentation3.ppt

8

0

0

0

0

0

0 00

0 0 0 0 0 0 0

0000 10000100 1100

1

1

1

1

1

1 11

1 1 1 1 1 1 1

8 byte0101

Heap Model

0

0

0

0

0

0 00

0 0 0 0 0 0 0

0000 10000100 1100

1

1

1

1

1

1 11

1 1 1 1 1 1 1

Heap Model

10

0

0 0

0 00

0 0 0 0 0

0000 10000100 1100

1

1 1

1 11

1 1 1 1 1

Heap Model

11

0

0 0

0 00

0 0 0 0 0

0000 10000100 1100

1

1 1

1 11

1 1 1 1 1

Heap Model

12

0

0 0

00

0 0

0000 10000100 1100

1

1 1

11

1 1

Heap Model

13

0

0 0

00

0 0

1

1 1

11

1 1

Start address: 0101Size: 8Access count: 19Last access time: 19’000’000Alloc site:EIP 0x400019Last access site: EIP 0x400190

Heap Model

Leak Reporting

β€’ Benchmarksβ€’ SPECInt2000

β€’ Largest data

β€’ Case studyβ€’ Large Interactive Web Application

β€’ 3rd Party PC Game (Strategy)

β€’ Multimedia Application

β€’ First Party PC Game (Simulation)

Experiments

Runtime Overhead

Space Overhead

Impact of Adaptive Profiling on Leak Detection

Staleness Prediction Evaluation

Case Studies


Top Related