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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:41:16+00:00 2026-06-17T14:41:16+00:00

I use UIAlertview to input some text, and it works fine. However, after the

  • 0

I use UIAlertview to input some text, and it works fine.
However, after the alertview is closed, there is still more than 17MB increase in memory before alertview is opened(from 9MB to 26 MB). I used Instrument Allocation to measure heap memory and activity monitor to measure it. Both of them show the similar result. When I switch to other App, the memory increased by alertview will be reduced to the proper level. Is it normal ? My environment is iPhone4+iOS6.
Here’s some code for trying.

   UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"input caption" message:@"text"
                                                   delegate:self cancelButtonTitle:@"cancel"  otherButtonTitles:@"OK", nil];
   [alert show];
   [alert release];

Thank you.


Dear Naveed S and Purr,
Thank you very much.
I’m not sure I follow your suggestion correctly. But I use Activity monitor watch the Real mem, the memory still increase about 20 MB after alertview is closed. I remove [alert release] after [alert show], and I wrote

  [alert show];
 //[alert release];

 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
 { [alertView dismissWithClickedButtonIndex:buttonIndex animated:YES];
  [alertView autorelease];                                                      }      

Moreovre, the memory is reduced when the app enter background mode after I press home. (This is similar as my previous code). How could I watch the abandon memory correctly. I’m even not sure how to watch it in the right way…..

BTW, my original codes follow the post here. Uialertview and memory management

  • 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-17T14:41:17+00:00Added an answer on June 17, 2026 at 2:41 pm

    For one thing, you should autorelease your alertView. -alertView:didDismissWithButtonIndex: is called by the UIAlertView, so the alertView object should still be valid (not -release'd) when your method returns.

    Better yet, convert to ARC and be done with manual -retain, -release and -autorelease 😉

    If you’re not converting to ARC, do this: remove the -release from the code in your original post, uncomment the //CRASH in your -alertView:didDismissWithButtonIndex: method and change the -release to -autorelease there.

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

Sidebar

Related Questions

Are there situations where a UIAlertView is better to use than a UIActionSheet? What
I first use [UIAlertView alloc] initWithTitle: to resize and customize AlertView with image but
What is some starter code I could use to make a simple UIAlertView with
I am having problem with AlertView. I am trying to use the UIAlertView and
I hope to use an UIAlertView prompt to reminder user some messages, the alerview
i have been trying to copy text input from alertview textfield to a NSMutableArray
In my application I use a UIAlertView to display to the user a message
use Text::Table; my $tb = Text::Table->new(Planet,Radius\nkm,Density\ng/cm^3); $tb->load( [ Mercury,2360,3.7], [ Mercury,2360,3.7], [ Mercury,2360,3.7], );
use strict; use warnings; use Time::HiRes qw(sleep); use Test::WWW::Selenium; use Test::More no_plan; use Test::Exception;
use Text::Diff; for($count = 0; $count <= 1000; $count++){ my $data_dir=archive/oswiostat/oracleapps.*dat; my $data_file= `ls

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.