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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:08:52+00:00 2026-05-17T15:08:52+00:00

In order to try the memory leaks instrument tool, I create a view-based ipad

  • 0

In order to try the memory leaks instrument tool, I create a view-based ipad application. It is very simple. I create a default view-based application. In the ViewController’s loadView, I say

// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {

    [super loadView];

    UIView *view = [[UIView alloc] init];
    view.frame = CGRectMake(0, 0, 768, 1004);
    view.backgroundColor = [UIColor redColor];
    [self.view addSubview:view];
    [view removeFromSuperview];
}

So, I create a view inside loadView, then add it to the root view, then remove it.

But the view is created in a method and I never release it.

So I think after loadView finishes, the created view is leaked right?

I used memory leaks instrument tool to check, it reports no leak at all.

Any one could pls explain it why?

thanks

  • 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-17T15:08:53+00:00Added an answer on May 17, 2026 at 3:08 pm

    The leaks tool — either command line or the Allocations Instrument — reports a leak as an object that is no longer referenced by anything. The problem, though, is that a stray pointer to the object may still be in memory somewhere, even if that memory will never be read again.

    I.e. the leaks instrument is not 100% accurate and it strives to not give false positives (which are much more troublesome).

    I generally use the Allocations instrument, go through the list of objects that are “live” at any given time and mentally justify their existence.

    You are correct in that said code snippet will cause a leak of the UIView instance. If you were to build and analyze, I would expect that Xcode would identify the problem.

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

Sidebar

Related Questions

So I am trying to create a Memory Management System. In order to do
In order to fully use LinqToSql in an ASP.net 3.5 application, it is necessary
In order to create an arbitrary precision floating point / drop in replacement for
In order to create the proper queries I need to be able to run
I am trying to work out some memory leak issues in an application, and
In order to find more easily buffer overflows I am changing our custom memory
We have an application based on Excel 2003 and Python 2.4 on Windows XP
In order to perform a case-sensitive search/replace on a table in a SQL Server
In order to know how many times a pattern exists in current buffer, I
In order to debug an asp.net web app I have to have IE Script

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.