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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:23:21+00:00 2026-05-13T09:23:21+00:00

My CF application has a very customized UI, using lots of images as UI

  • 0

My CF application has a very customized UI, using lots of images as UI elements. The UI feels a lot more smooth when these bitmaps are kept in memory. When they’re loaded on demand, the UI is slow and I can see the buttons appearing one by one, which looks very poor.
For a long time this went pretty well, but recently I’ve found the application nearly uses all the memory it can get, which is 32MB iirc. I then started using the remote performance monitor to see if I could find any clear memory hogs.

As it turns out, getting a useful snapshot of the GC heap using RPM is hard: close before I’m likely to receive out of memory exceptions, requesting a snapshot causes a native exception to be thrown instantly. I can manage to find a GC snapshot once in a while though. I saved one here: http://files.zzattack.org/misc/ramis.gclog and a screenshot here: http://files.zzattack.org/images/ramisgcsnapshot.png
To me it doesn’t look all that troublesome, by far the largest object is a byte array containing my resources file (about 3MB full of PNG images). Alltogeher, 3643304b (about 3.5MB) of memory is used. These images are spread over UI elements in about 20 different forms. I’m don’t know what impact seperate threads have on memory usage, but about 5-6 threads are running simultaneously, of which at least 4 are in a blocked state 95% of the time.

In the program, when I attempt to download a 2MB gzipped file, I will always receive an OutOfMemoryException. When I call GC.GetTotalMemory(false), I see that I am indeed attempting to allocate more than is currently available. Calling GC.Collect and trying again doesn’t ‘solve’/postpone my problem either.

I would like some advice on how to tackle my problem. I absolutely do want the bitmaps in memory, but perhaps I could limit the amount of slots available for bitmaps, keeping only the most frequently needed ones in memory and loading others on demand. This is probably a long shot, but perhaps I could request the OS to reserve more memory for me? I know for sure that the application will only run on devices that have enough RAM available anyway. Any help is appreciated, thanks in advance.

  • 1 1 Answer
  • 1 View
  • 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-05-13T09:23:22+00:00Added an answer on May 13, 2026 at 9:23 am

    If you’re using the same images on multiple forms, you should consider to keep those Bitmaps as static variables in a class that is accessible by all your forms.

    public class AppBitmaps
    {
      public static Bitmap LogoBitmap = new Bitmap(...);
    
      public static Bitmap ButtonBitmap = new Bitmap(...);
    }
    
    public class Form1
    {
      public Form1()
      {
        this.Control1.Image = AppBitmaps.LogoBitmap;
      }
    }
    

    That way you only keep one instance of that image in memory, which should cut down the overall memory usage.

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

Sidebar

Related Questions

I am building a web application using ASP.NET MVC that has two very distinct
My Silverlight application, using the navigation framework, has very pretty endings to its URLs,
I have a console application which has target .NET 2.0 It is very short
I have a 3yr old application that has some controllers with some very unrestful
Im Developing a web application which is very critical. So authentication has to be
I am going to create a new web application that is very customized. It
I've been working on a C# ASP.Net application that requires images to be customized
My VB.NET application has a very important boolean variable. I need to be able
In an ASP.NET MVC application (which has very little chance of having its view
I'm developing an Android Application that has three very similar Activities. I would like

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.