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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:44:07+00:00 2026-05-20T11:44:07+00:00

My app gives a low memory crash on the device and not on the

  • 0

My app gives a low memory crash on the device and not on the simulator.I used Instruments and i think that the problem lies in the following part

       UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

       [button setBackgroundImage:[UIImage imageNamed:@"gembtnblu.png"]  forState:UIControlStateNormal];<br>

        button.frame = CGRectMake(0, 0, TOOLBAR_BUTTON_WIDTH , TOOLBAR_BUTTON_HEIGHT);<br>

        [button setTitle:[NSString stringWithFormat:@"%c",choice] forState:UIControlStateNormal];<br>

        [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

        [button addTarget:self action:@selector(ChoiceButtonTouched:) forControlEvents:UIControlEventTouchUpInside];

        [button setTag:choice];

        UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];

        //Add button to the array
        [tempItems addObject:customBarItem];

        if (isReviewing == TRUE) {
            customBarItem.customView.userInteractionEnabled=FALSE;
        }
        //release buttons
        [customBarItem release];

        numberOfChoices++;

But im not able to spot the problem.Please help guuys, i have beeen stuck at this for days now

heres some more code


NSArray *items=[[NSArray alloc] initWithArray:(NSArray *)tempItems];
[tempItems release];

//add array of buttons to toolbar
[toolbar setItems:items animated:YES];
[self.view addSubview:toolbar];

the static analyser says that theres a potential leak with ‘items’ array.But if i put in a release statement, the app crashes

  • 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-20T11:44:08+00:00Added an answer on May 20, 2026 at 11:44 am

    Did you release the toolbar after adding it as a subview? If you did not, and are not releasing the toolbar in the dealloc, there’s your leak.

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

Sidebar

Related Questions

I have an android app that I am trying to launch and it gives
When I run the following Silverlight app, it gives me the error : AG_E_PARSER_BAD_PROPERTY_VALUE
I have an ASP.NET Login App that creates a cookie called 'ASP_LOGIN77' and gives
I'm trying to get some app info using Apple API, that gives me an
I recently had an app rejected from the app store because of Low Memory
I've got an app that caches a pretty decent amount of data in memory
I'm developing for Android and I have an app (called Forget-Me-Not) that uses a
I'm developing an app for iOS and I'm running into issues with low memory
I am making a quiz app for chemistry reactions. The app gives the user
I have an android app which gives the user the option of loading a

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.