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

  • SEARCH
  • Home
  • 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 9116881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:46:44+00:00 2026-06-17T04:46:44+00:00

I am working on application which uses downloaded images from my application to display

  • 0

I am working on application which uses downloaded images from my application to display in the background. When I start application it works fine and load image without any problem. But after several restart application crashes with memory error. I use below method for get Drawable to show it in View. I have used one class and which having this static method I use it for all images. I also call one other static method for clear bitmap but don’t know it works or not. May be I do not able to clear memory when I close application.

    public static void recycle_bitmap() {
    if (myBitmap != null) {
        myBitmap.recycle();
        myBitmap = null;

    }

    }

    static Bitmap myBitmap = null;

    public static Drawable ImgDrawableFromFile(Resources res, String file_name) {

    myBitmap=null;
    File imgFile = new File("/data/data/com.appstart/app_my_sub_dir/"
            + file_name + ".jpg");
    if (imgFile.exists()) {

        myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
        if (myBitmap != null)
            return new BitmapDrawable(res, myBitmap);
        else
            return null;
    }
    return null;

    }

Logcat error

01-11 12:09:41.860: D/dalvikvm(6047): GC_EXTERNAL_ALLOC freed 598K, 48% free                  3336K/6407K, external 8683K/10523K, paused 274ms
01-11 12:09:42.149: E/dalvikvm-heap(6047): 1671840-byte external allocation too large for this process.
01-11 12:09:42.480: I/dalvikvm-heap(6047): Clamp target GC heap from 16.094MB to 16.000MB
01-11 12:09:42.480: E/GraphicsJNI(6047): VM won't let us allocate 1671840 bytes
01-11 12:09:42.501: D/dalvikvm(6047): GC_FOR_MALLOC freed 1K, 48% free 3334K/6407K,    external 8674K/10523K, paused 247ms
01-11 12:09:42.501: D/skia(6047): --- decoder->decode returned false
01-11 12:09:42.501: W/dalvikvm(6047): threadid=15: thread exiting with uncaught exception (group=0x40015560)
01-11 12:09:42.560: E/AndroidRuntime(6047): FATAL EXCEPTION: Thread-18
01-11 12:09:42.560: E/AndroidRuntime(6047): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
01-11 12:09:42.560: E/AndroidRuntime(6047):     at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
01-11 12:09:42.560: E/AndroidRuntime(6047):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:470)
01-11 12:09:42.560: E/AndroidRuntime(6047):     at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:284)
01-11 12:09:42.560: E/AndroidRuntime(6047):     at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:309)
01-11 12:09:42.560: E/AndroidRuntime(6047):     at com.appstart.utility.LoadImage.ImgDrawableFromFile(LoadImage.java:30)
01-11 12:09:42.560: E/AndroidRuntime(6047):     at com.appstart.MainActivity.run(MainActivity.java:70)
01-11 12:09:42.560: E/AndroidRuntime(6047):     at java.lang.Thread.run(Thread.java:1019)
  • 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-17T04:46:45+00:00Added an answer on June 17, 2026 at 4:46 am

    Follows these three tutorials to avoid Memory error.

    Avoid Memory Leaks

    Attacking Memory Problems on Android

    Future-Proofing Your App

    and In particular, using static variables is likely to make things worse, not better.
    so please remove it.and put it outside static method.

    it may be also cause due to large image size.please scale it to small size.or increase your Vm’s heapsize.

    it might help you.

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

Sidebar

Related Questions

I'm working on an Android Application which uses the Tab Host icons downloaded from
I'm working on a very graphic-heavy application which uses content from a bunch of
I'm working on an application which uses data from db which has to be
I have an MVC application which uses Windsor everywhere and it works fine everywhere
I'm working in an iOS application which uses libXML2 to read XML retrieved from
I'm working on a web based application which uses a JSON over HTTP based
I am currently working on a sample application which uses QNetworkAccessManager to send the
I am working on a caching strategy for our application, which uses both Redis
i am working on an application which uses the iPod like application in iPhone..
I'm working on an application which uses a bootscrapper object to perform some operations

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.