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

The Archive Base Latest Questions

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

I have a question regarding memory management in objective-c. I have read Apple’s various

  • 0

I have a question regarding memory management in objective-c. I have read Apple’s various documents regarding this but I still don’t seem to be grasping it. I have created a small sample app to demonstrate my confusion. When I launch the app Activity Monitor states that it’s using about 7MB. When I execute the main loop the memory usage goes up to 44MB which is expected. However, when I release the array I only get about 14MB back in Activity Monitor. The app continues to use about 30MB. Shouldn’t I get all my memory back return the “Real Memory” to 7MB in Activity Monitor?

What am I doing wrong?

Thanks in advance.

Here is the AppDelegate:

- (IBAction) buildArray:(id)sender {
    values = [[NSMutableArray alloc] init]; // values is an instance variable of the appDelegate
    for(int i = 0; i < 500000; ++i) {
        NSString *tempString = [NSString stringWithFormat:@"New Object %i", i];
        [values addObject:tempString];
    }
    [valuesTable reloadData];  // valuesTable is a NSTableView to diplay the array.
}

- (IBAction) clearMemory:(id)sender {
    [values release];
    [valuesTable reloadData];
}

- (int) numberOfRowsInTableView: (NSTableView *) tableView {
    if (values) {
        return [values count];
    } else {
        return 0;
    }
}

- (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) tableColumn row: (int) row {
    return [values objectAtIndex:row];
}
  • 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-20T12:11:07+00:00Added an answer on May 20, 2026 at 12:11 pm

    This has been answered a multitude of times before; but the act of releasing an object does not immediately return memory to the system. The application holds on to parts of the arena that lie unused, waiting for them to be reallocated.

    If they are actually requested by the system, it gives up these resources, but as long as no other process wants the memory, your application will hang on to it, “just in case”.

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

Sidebar

Related Questions

I have a quick question regarding memory management that I am not quite sure
I have a question regarding the JVM memory management (at least for the SUN's
I have a question regarding memory deallocation and exceptions. when I use delete to
Hi have some question regarding spatial and temporal locality. I have read in the
I have a question regarding the two additional columns (timeCreated, timeLastUpdated) for each record
I have a question regarding an update function I created... CREATE OR REPLACE FUNCTION
I have a question regarding handling errors in a J2EE application. Our current application
I'm writing a small webapp in Grails and I have the following question regarding
Following on from my recent question regarding parsing XML files in Java I have
I have a question about best practices regarding how one should approach storing complex

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.