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 8634433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:43:23+00:00 2026-06-12T09:43:23+00:00

I started getting the OutOfMemoryError for my game. I thought it was because I

  • 0

I started getting the OutOfMemoryError for my game. I thought it was because I was creating new Bitmaps for each animation (so there were multiple Bitmaps of the same image), but then I created an ImageLoader class to only load each Bitmap once then the objects that need the images just use a reference to them.

However, there are a lot of images in my game for animations, background, items, etc. I just added a few more items and now I keep getting the error.

How do other games handle having a lot of images? I’m sure many other games have more images than mine do and can still avoid this error.

Is there a different/better way to implement an ImageLoader than what I’ve been doing?

Thanks a lot, guys!

  • 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-12T09:43:25+00:00Added an answer on June 12, 2026 at 9:43 am

    Game developers solve this problem by spending a lot of time optimizing image sizes and making use of memory caches.

    It’s important to know how much memory your app has to work with, and not to exceed it. You can set up an LRU (Least-Recently Used) cache that will ensure that the total memory footprint of your bitmaps stays under a certain size. You just insert the bitmaps into the cache, and once the cache reaches its maximum allowed size (something that you specify), it will begin to unload bitmaps that haven’t been used in a while.

    There some very good info, including code snippets, in this article from the Android documentation.

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

Sidebar

Related Questions

I'm currently working on a game, and just a while ago i started getting
I recently migrated to new version of protobuf-net, and i started getting this error
I started getting the following error whenever i use SVN in my server: svn:
I've just started getting into Catalyst, and I've been finding it really helpful. One
My company recently started getting up to date on the usage of TFS, source
I figured when I started getting stack overflow it was time to come here
Lately we've started getting issues with outdated countries / regions list being presented to
I just started getting into iPhone development. I have been mish-mashing tutorials and material
I just started getting this error today, seemingly out of nowhere. Any one see
Suddenly I started getting the following error: Fatal error: Class 'Mongo' not found in

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.