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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:29:37+00:00 2026-05-20T17:29:37+00:00

I created a sample application that where I have a basic fullscreensize UIImageView set

  • 0

I created a sample application that where I have a basic fullscreensize UIImageView set as the background. This app is very simple. All it is is 2 pages. (I will post the code below). The NIB only as UIImageView. I have tried 2 different scenarios –

Is there a problem with releasing NIB files and images.

I have been experiencing some memory leaks.

1) Example 1 (BAD)- I load the image directly in to the NIB. When I push the view, memory goes up by 5MB. When I pop (using NavigationController) the View off of the top, memory only goes down by a 1.5MB. Dealloc is indeed called. I have no IBOutlets. So, to me this is either caching or retaining this image in memory somewhere.

2) Example 2 (GOOD)- Set an IBOutlet for the UIImage view and I put the image in the UIImageview as shown below(I know I could create the UIImageView programmatically, but I am testing memory here not my screen creation skills). This cleans up nicely after itself. It removes the image from memory and I can see in Instruments that memory goes down.

@interface Page3VC : UIViewController {
    UIImageView*backimage;
}
@property(retain, nonatomic) IBOutlet UIImageView*backimage;
end

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];

    backimage.image = [self getImage:@"hipHome.png"];
}
-(void)viewDidDisappear:(BOOL)animated {
    backimage.image = nil;

    [super viewDidDisappear:animated];
}

-(UIImage*)getImage:(NSString*)imageName{
    //return [UIImage imageNamed:imageName];
    return [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageName ofType:nil]];
}
  • 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-05-20T17:29:38+00:00Added an answer on May 20, 2026 at 5:29 pm

    Loading images via the NIB can be problematic — it’s known to ‘leak’ due to caching behaviour, but this is by design — please see this question. This caching is useful for showing small images in UITables (high performance), but not good for loading a single huge image into your UI.

    We need to see more of your code! How is getImage defined?

    If you’re using UIImage imageNamed: anywhere in your own code, you should be aware that it caches loaded images in memory. Dealloc’ing such an image won’t actually unload the cached image in memory!

    For more info, please see:

    Difference between [UIImage imageNamed…] and [UIImage imageWithData…]?

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

Sidebar

Related Questions

I'm trying to add a strongly-typed view to the sample app that's created when
In a simple winform application, I call a function that endlessy create files on
I've created a simple desktop application in C# 3.0 to learn some C#, wpf
I created a simple .NET windows application in Visual Studio 2005 and on just
I created a simple dialog-based application, and in the default CDialog added three buttons
I'm planning to create a simple gadget to create a TO DO list application.
For a web application, I would like to create a simple but effective licensing
I am new to ADO.net. I actually created a sample database and a sample
So I'm a newbie to TDD, and I successfully created a nice little sample
Given an object like: class M(models.Model): test = models.BooleanField() created_date = models.DateTimeField(auto_now_add=True) Given sample

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.