SlideShare una empresa de Scribd logo
1 de 7
Descargar para leer sin conexión
RxJava에서 쓸만한 팁들 모아보기
프렌트립 이하제
제일 기본적인 안드로이드 RxJava에서의 메모리 관리
생명 주기 안에서 발생한 Subscription들을

CompositeSubscription에 몰아서 onDestroy에서 clear() 시킨다.
Example 1 - 1.
좀 더 안드로이드 생명주기에서 맞추려면?
Trello의 RxLifecycle을 사용(RxAndroid 1.0부터는 AppObservable을 대체함)

compose에서 바인딩해서 라이브러리에게 맡길 수 있음.
Example 1 - 2.
좀 더 근본적인 방법은 없을까?
Subscriber의 Decorator를 통해 WeakReference로 감싸서

Observable과 Subscriber간의 관계를 약하게 만들어봄.

결과 : “WeakReference가 참조하고 있는 Subscriber가 null이 됨”
Example 1 - 3.
RxJava에서 편하게 디버깅하는 방법
frodo를 사용하면 어노테이션을 달아서 편하게 로그를 볼 수 있다.

rxjava-debug로 Hook을 거는 방법도 있다.
좀 더 좋은 방법에 대한 고찰
이렇게 쓰는게 좋은 것이 맞을지에 대한 의견을 공유해봅시다.

+1. 이것보다 더 좋은 방법이 있을까요?
References.
• Airbnb에서 적용한 RxJava (링크 / 영어)

• RxAndroid 1.0부터의 라이크사이클 바인딩 (링크 / 일본어)

• RxJava에서 Memory Leak을 예방하는 방법 (링크 / 영어)

• Debugging RxJava in Android:Frodo (링크 / 영어)

• GitHub trello/RxLifecycle

• GitHub android10/frodo

Más contenido relacionado

Destacado

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destacado (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

GDG Korea Android - RxJava에서 쓸만한 팁들 모아보기

  • 1. RxJava에서 쓸만한 팁들 모아보기 프렌트립 이하제
  • 2. 제일 기본적인 안드로이드 RxJava에서의 메모리 관리 생명 주기 안에서 발생한 Subscription들을 CompositeSubscription에 몰아서 onDestroy에서 clear() 시킨다. Example 1 - 1.
  • 3. 좀 더 안드로이드 생명주기에서 맞추려면? Trello의 RxLifecycle을 사용(RxAndroid 1.0부터는 AppObservable을 대체함) compose에서 바인딩해서 라이브러리에게 맡길 수 있음. Example 1 - 2.
  • 4. 좀 더 근본적인 방법은 없을까? Subscriber의 Decorator를 통해 WeakReference로 감싸서 Observable과 Subscriber간의 관계를 약하게 만들어봄. 결과 : “WeakReference가 참조하고 있는 Subscriber가 null이 됨” Example 1 - 3.
  • 5. RxJava에서 편하게 디버깅하는 방법 frodo를 사용하면 어노테이션을 달아서 편하게 로그를 볼 수 있다. rxjava-debug로 Hook을 거는 방법도 있다.
  • 6. 좀 더 좋은 방법에 대한 고찰 이렇게 쓰는게 좋은 것이 맞을지에 대한 의견을 공유해봅시다. +1. 이것보다 더 좋은 방법이 있을까요?
  • 7. References. • Airbnb에서 적용한 RxJava (링크 / 영어) • RxAndroid 1.0부터의 라이크사이클 바인딩 (링크 / 일본어) • RxJava에서 Memory Leak을 예방하는 방법 (링크 / 영어) • Debugging RxJava in Android:Frodo (링크 / 영어) • GitHub trello/RxLifecycle • GitHub android10/frodo