SlideShare a Scribd company logo
Static Analysis of Context
Leaks in Android Applications
Flavio Toffalini, Sun Jun, and Martín Ochoa
Singapore University of Technology and
Design
Outline
• Goal
• Android Life-cycle
• Context Memory Leaks
• Our Analysis
• Experiments
Detect
Context memory leaks
in Android applications
Android
employs a
garbage
collector
Developers
cannot
trigger
memory
deallocation
Automatic
garbage
collection is
not perfect
Some objects
are not
deallocated
Android life-cycle
Android life-cycle
Some objects follow a life-cycle (e.g., Activities)
Only Android can change the state of an object
The developer can only drive objects status by
implementing callback functions
It is impossible to avoid an object destruction BUT it is
possible to intercept events and close it gracefully
Life-cycle objects are “subclasses” of
Context classes
Context Memory Leaks
Static-fields
Thread-like objects
Manager (interfaces)
Context Memory Leaks – Static Fields
// things for handling a GUI static Activity a;
void method1() {}
int setA() {}
void getA() {}
Class CActivity A (subclass of Context)
Created
Running…
Running…
Running…
Destroyed
This field does not allow the
GC to deallocate A’s memory
Context Memory Leaks – Thread-like objects
// things for handling a GUI
void run() {
// I’m doing my long
// long process!
}
Thread T (inner class)
Activity A (subclass of Context)
Created
Running…
Thread
running…
Running…
Destroyed
This is a synthetic field that
does not allow the GC to
deallocate A’s memory
till the thread T is running
Context Memory Leaks – Managers
// things for handling a GUI
void onCallbackFuntion() {
// I do my callback duties
}
void a() {
setManager(this);
}
Activity A implement Callback
(subclass of Context)
Created
Running…
Callback
assignment
Running…
Destroyed
This assignment does not allow the GC to
deallocate A’s memory
Our Analysis – overview
APK Warnings
Julia analyzer
Our Analysis – overview
APK Warnings
Julia analyzer
What Julia does:
- Simulate android life-cycle
- Create a full CFG (besides reflection)
- Implement abstract interpretation (e.g., for backward analysis)
Our Analysis - intuition
Not all Context are bad guys..
Context
Activity Service ApplicationContextBroadcastReceiver
This is a safe Context
It is valid as long as the application is running
Our Analysis - intuition
Application Context is returned by getApplicationContext()
Activity a = …;
Context c = (Context)a;
Context c = getApplicationContext();
Bad Context
Good Context!
Our Analysis
How can a field reach a Context?
- It points to a Context subclass
- It points to a Context-container
That’s trivial
That’s not trivial at all
Our Analysis – Context-container
static Class2 c2 // GUI stuffs
Class1 Class2 Activity
Class3 c3 Class4 c4
Class3
Context-containers
Our Analysis
1. List all fields that point to a Context subclass
or to a context-container
2. Backward analysis to identify the nature of the fields:
1. If all producers are ApplicationContext or Null, the field does not leak
2. Else, the field will leak
Evaluation
We selected 8 open source applications
Compared to another memory leak analyzers: Lint
Evaluation
Thanks! Q&A

More Related Content

Similar to Static Analysis of Context Leaks in Android Applications

Exploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App developmentExploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App development
Jayaprakash R
 
Advanced android app development
Advanced android app developmentAdvanced android app development
Advanced android app development
Rachmat Wahyu Pramono
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
YoungSu Son
 
Understanding memory management in xamarin forms
Understanding memory management in xamarin formsUnderstanding memory management in xamarin forms
Understanding memory management in xamarin forms
Tsvyatko Konov
 
Common mistakes in android development
Common mistakes in android developmentCommon mistakes in android development
Common mistakes in android development
Hoang Nguyen Huu
 
Inside the Android application framework - Google I/O 2009
Inside the Android application framework - Google I/O 2009Inside the Android application framework - Google I/O 2009
Inside the Android application framework - Google I/O 2009
Viswanath J
 
Ase02.ppt
Ase02.pptAse02.ppt
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Sigma Software
 
Garbage collection
Garbage collectionGarbage collection
Garbage collection
Somya Bagai
 
Meetup - Singleton & DI/IoC
Meetup - Singleton & DI/IoCMeetup - Singleton & DI/IoC
Meetup - Singleton & DI/IoC
Dusan Zamurovic
 
OpenWebBeans and DeltaSpike at ApacheCon
OpenWebBeans and DeltaSpike at ApacheConOpenWebBeans and DeltaSpike at ApacheCon
OpenWebBeans and DeltaSpike at ApacheCon
os890
 
Singleton Object Management
Singleton Object ManagementSingleton Object Management
Singleton Object Management
ppd1961
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
NAVER D2
 
Design patterns in javascript
Design patterns in javascriptDesign patterns in javascript
Design patterns in javascript
Ayush Sharma
 
performance optimization: Memory
performance optimization: Memoryperformance optimization: Memory
performance optimization: Memory
晓东 杜
 
Prospector Osq 2004 Final
Prospector Osq 2004 FinalProspector Osq 2004 Final
Prospector Osq 2004 Final
kurniawan.kuga
 
Five android architecture
Five android architectureFive android architecture
Five android architecture
Tomislav Homan
 
Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14
Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14
Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14
Pavol Bielik
 
Os Haase
Os HaaseOs Haase
Os Haase
oscon2007
 
Droid con 2013 workshop unit testing in android [robolectirc]
Droid con 2013 workshop   unit testing in android [robolectirc]Droid con 2013 workshop   unit testing in android [robolectirc]
Droid con 2013 workshop unit testing in android [robolectirc]
Leena N
 

Similar to Static Analysis of Context Leaks in Android Applications (20)

Exploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App developmentExploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App development
 
Advanced android app development
Advanced android app developmentAdvanced android app development
Advanced android app development
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
Understanding memory management in xamarin forms
Understanding memory management in xamarin formsUnderstanding memory management in xamarin forms
Understanding memory management in xamarin forms
 
Common mistakes in android development
Common mistakes in android developmentCommon mistakes in android development
Common mistakes in android development
 
Inside the Android application framework - Google I/O 2009
Inside the Android application framework - Google I/O 2009Inside the Android application framework - Google I/O 2009
Inside the Android application framework - Google I/O 2009
 
Ase02.ppt
Ase02.pptAse02.ppt
Ase02.ppt
 
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
 
Garbage collection
Garbage collectionGarbage collection
Garbage collection
 
Meetup - Singleton & DI/IoC
Meetup - Singleton & DI/IoCMeetup - Singleton & DI/IoC
Meetup - Singleton & DI/IoC
 
OpenWebBeans and DeltaSpike at ApacheCon
OpenWebBeans and DeltaSpike at ApacheConOpenWebBeans and DeltaSpike at ApacheCon
OpenWebBeans and DeltaSpike at ApacheCon
 
Singleton Object Management
Singleton Object ManagementSingleton Object Management
Singleton Object Management
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
 
Design patterns in javascript
Design patterns in javascriptDesign patterns in javascript
Design patterns in javascript
 
performance optimization: Memory
performance optimization: Memoryperformance optimization: Memory
performance optimization: Memory
 
Prospector Osq 2004 Final
Prospector Osq 2004 FinalProspector Osq 2004 Final
Prospector Osq 2004 Final
 
Five android architecture
Five android architectureFive android architecture
Five android architecture
 
Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14
Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14
Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14
 
Os Haase
Os HaaseOs Haase
Os Haase
 
Droid con 2013 workshop unit testing in android [robolectirc]
Droid con 2013 workshop   unit testing in android [robolectirc]Droid con 2013 workshop   unit testing in android [robolectirc]
Droid con 2013 workshop unit testing in android [robolectirc]
 

More from Flavio Toffalini

SGXMonitor Presentation - ACSAC 2022
SGXMonitor Presentation - ACSAC 2022SGXMonitor Presentation - ACSAC 2022
SGXMonitor Presentation - ACSAC 2022
Flavio Toffalini
 
SnakeGX (full version)
SnakeGX (full version) SnakeGX (full version)
SnakeGX (full version)
Flavio Toffalini
 
SnakeGX (short version)
SnakeGX (short version)SnakeGX (short version)
SnakeGX (short version)
Flavio Toffalini
 
ScaRR
ScaRRScaRR
Careful Packing
Careful PackingCareful Packing
Careful Packing
Flavio Toffalini
 
Google Dorks: Analysis, Creation, and new Defenses
Google Dorks: Analysis, Creation, and new DefensesGoogle Dorks: Analysis, Creation, and new Defenses
Google Dorks: Analysis, Creation, and new Defenses
Flavio Toffalini
 

More from Flavio Toffalini (6)

SGXMonitor Presentation - ACSAC 2022
SGXMonitor Presentation - ACSAC 2022SGXMonitor Presentation - ACSAC 2022
SGXMonitor Presentation - ACSAC 2022
 
SnakeGX (full version)
SnakeGX (full version) SnakeGX (full version)
SnakeGX (full version)
 
SnakeGX (short version)
SnakeGX (short version)SnakeGX (short version)
SnakeGX (short version)
 
ScaRR
ScaRRScaRR
ScaRR
 
Careful Packing
Careful PackingCareful Packing
Careful Packing
 
Google Dorks: Analysis, Creation, and new Defenses
Google Dorks: Analysis, Creation, and new DefensesGoogle Dorks: Analysis, Creation, and new Defenses
Google Dorks: Analysis, Creation, and new Defenses
 

Recently uploaded

AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 

Recently uploaded (20)

AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 

Static Analysis of Context Leaks in Android Applications

  • 1. Static Analysis of Context Leaks in Android Applications Flavio Toffalini, Sun Jun, and Martín Ochoa Singapore University of Technology and Design
  • 2. Outline • Goal • Android Life-cycle • Context Memory Leaks • Our Analysis • Experiments
  • 3. Detect Context memory leaks in Android applications
  • 5. Android life-cycle Some objects follow a life-cycle (e.g., Activities) Only Android can change the state of an object The developer can only drive objects status by implementing callback functions It is impossible to avoid an object destruction BUT it is possible to intercept events and close it gracefully Life-cycle objects are “subclasses” of Context classes
  • 6. Context Memory Leaks Static-fields Thread-like objects Manager (interfaces)
  • 7. Context Memory Leaks – Static Fields // things for handling a GUI static Activity a; void method1() {} int setA() {} void getA() {} Class CActivity A (subclass of Context) Created Running… Running… Running… Destroyed This field does not allow the GC to deallocate A’s memory
  • 8. Context Memory Leaks – Thread-like objects // things for handling a GUI void run() { // I’m doing my long // long process! } Thread T (inner class) Activity A (subclass of Context) Created Running… Thread running… Running… Destroyed This is a synthetic field that does not allow the GC to deallocate A’s memory till the thread T is running
  • 9. Context Memory Leaks – Managers // things for handling a GUI void onCallbackFuntion() { // I do my callback duties } void a() { setManager(this); } Activity A implement Callback (subclass of Context) Created Running… Callback assignment Running… Destroyed This assignment does not allow the GC to deallocate A’s memory
  • 10. Our Analysis – overview APK Warnings Julia analyzer
  • 11. Our Analysis – overview APK Warnings Julia analyzer What Julia does: - Simulate android life-cycle - Create a full CFG (besides reflection) - Implement abstract interpretation (e.g., for backward analysis)
  • 12. Our Analysis - intuition Not all Context are bad guys.. Context Activity Service ApplicationContextBroadcastReceiver This is a safe Context It is valid as long as the application is running
  • 13. Our Analysis - intuition Application Context is returned by getApplicationContext() Activity a = …; Context c = (Context)a; Context c = getApplicationContext(); Bad Context Good Context!
  • 14. Our Analysis How can a field reach a Context? - It points to a Context subclass - It points to a Context-container That’s trivial That’s not trivial at all
  • 15. Our Analysis – Context-container static Class2 c2 // GUI stuffs Class1 Class2 Activity Class3 c3 Class4 c4 Class3 Context-containers
  • 16. Our Analysis 1. List all fields that point to a Context subclass or to a context-container 2. Backward analysis to identify the nature of the fields: 1. If all producers are ApplicationContext or Null, the field does not leak 2. Else, the field will leak
  • 17. Evaluation We selected 8 open source applications Compared to another memory leak analyzers: Lint