Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8334949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:30:49+00:00 2026-06-09T03:30:49+00:00

Normally I always use Drawable resources in Imageviews because I haven’t to manually release

  • 0

Normally I always use Drawable resources in Imageviews because I haven’t to manually release them.

But in some cases I need to dynamically create bitmaps and then I’ve to manually call recycle() on them in onDestroy(). That’s the best solution I’ve found according to that other StackOverflow question.

I want to understand how Android manages Drawable resources and why I haven’t to manually recycle them. And when understood see if similar logic can be applied to manually created bitmaps.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:30:51+00:00Added an answer on June 9, 2026 at 3:30 am

    A Drawable is much more broad than a Bitmap. Drawable is intended to represent anything the graphics system can render to the display. There are subclasses of Drawable – such as as ShapeDrawable, or ColorDrawable – that do not contain Bitmaps and hence do not need any sort of manual memory management.

    A BitmapDrawable wraps a Bitmap and contains a reference to a Bitmap. The Bitmap is special, because Android maintains the pixel data for all Bitmaps in a separate heap, which is managed separately from the rest of your application. When the Android garbage collector cleans up a Bitmap object, it also cleans up the the pixel data from the bitmap heap. But you can force it to happen sooner by manually calling recycle() on the Bitmap, which marks the Bitmap invalid and releases its pixel data.

    Android allocates a fixed size bitmap heap for each running application, and it is possible for your app to exhaust its heap by leaving too many Bitmaps in use at once. That’s why if your application uses bitmaps extensively, you will probably benefit from recycling bitmaps as soon as you know you won’t need them.

    Update: as noted in the comments, the separate bitmap heap applies to pre-Honeycomb versions of Android. As of Honeycomb, the bitmap heap was merged with the application heap. Here’s a SO post with more info.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Normally I use <base href=http://domain.com/ /><!--[if ie]></base><![endif]--> I haven't tried much with RewriteBase, I
In my websites normally I use Ajax, so the address is always something like
I would normally use Google analytics because it is free and simple to implement
I understand why an always-on service is normally an anti-pattern in Android, but my
I want to use NSLocalizedString in my app but it always failed. What i
When I paste things from the clipboard, they're normally (always) multilined, and in those
Normally whenever a CAPTCHA might be needed I always present it to the user
Normally, if I want to start a new activity I can use StartActivity(typeof(foo)); This
Normally we use window.location.href=/index.php?querystring; in javascript. Is there a way to send the querystring
I normally just use mysql_real_escape_string on every variable before inserting to my database, so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.