Mobile Development 4 min read

Optimizing Image Loading in the Beike Android App: Replacing Picasso with Glide to Prevent OOM

The article analyzes an OOM issue in the Beike Android app caused by large image memory usage, compares Picasso and Glide memory footprints, describes the refactoring effort required to switch libraries, explains Glide's two‑level caching mechanism, and highlights the performance and stability benefits for pre‑Android 8.0 devices.

Beike Product & Technology
Beike Product & Technology
Beike Product & Technology
Optimizing Image Loading in the Beike Android App: Replacing Picasso with Glide to Prevent OOM

Current Situation : During testing of the Beike real‑estate Android app, an Out‑Of‑Memory (OOM) crash was observed when browsing the second‑hand house list on devices running Android versions below 8.0, primarily because loaded images occupied excessive heap memory (Picasso: 220.7 MB, Glide: 85.8 MB).

Refactoring Cost : Switching from Picasso to Glide requires adding a Context parameter to existing image‑loading calls, but the change is limited to updating the method signatures and passing the extra context.

Technical Principle : Glide employs a two‑level cache – an activeResources map holding weak references to currently displayed images and an LruCache for off‑screen images. On the test device, Glide’s LruCache is only 16 MB compared with Picasso’s ~160 MB, resulting in roughly 50 % lower heap usage. Glide also integrates with the Activity/Fragment lifecycle, automatically pausing/resuming requests and cleaning up resources on onStop and onDestroy , which further reduces memory pressure.

Outlook : Among the three major Android image libraries (Glide, Picasso, Fresco), Glide is Google’s recommended solution. Replacing Picasso with Glide in the Beike app incurs minimal development effort while eliminating OOM crashes for the roughly 64 % of users still on Android 8.0 or lower.

Author: Gao Rui (Android Engineer, Beike)

Mobile DevelopmentperformanceAndroidoomGlidePicassoImage Loading
Beike Product & Technology
Written by

Beike Product & Technology

As Beike's official product and technology account, we are committed to building a platform for sharing Beike's product and technology insights, targeting internet/O2O developers and product professionals. We share high-quality original articles, tech salon events, and recruitment information weekly. Welcome to follow us.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.