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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:21:20+00:00 2026-06-07T15:21:20+00:00

I have tested my app using instrument and it show the following leak. When

  • 0

I have tested my app using instrument and it show the following leak.
enter image description here

When I double click on the CameraVC in the stack trace it refer to the following line into my code.
enter image description here

this happen when I call the camera, I call it using the following code:-

      - (IBAction) getCamera
{
    // set up our camera overlay view   
    // tool bar - handy if you want to be able to exit from the image picker...
    UIToolbar *toolBar=[[UIToolbar alloc] initWithFrame:CGRectMake(0, 480-44, 320, 44)];

    UIBarButtonItem *spaceItem  = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace  target:nil action:nil] autorelease];
    UIBarButtonItem *spaceItem1  = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace  target:nil action:nil] autorelease];
    UIBarButtonItem *cancelItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel  target:self action:@selector(cancelPickingImag)] autorelease];
    UIBarButtonItem *cameraItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera  target:self action:@selector(finishedAugmentedReality)] autorelease]; 

    spaceItem.width  = 2.0;
    spaceItem1.width = 55.0;
    NSArray *items=[NSArray arrayWithObjects:spaceItem,cancelItem,spaceItem1,cameraItem,nil];
    [toolBar setItems:items];

    // create the overlay view
    overlayView=[[OverlayView alloc] initWithFrame:CGRectMake(0, 300, 320, 480-44)];

    // important - it needs to be transparent so the camera preview shows through!
    overlayView.opaque=NO;
    overlayView.backgroundColor=[UIColor clearColor];

    // parent view for our overlay
    UIView *parentView=[[UIView alloc] initWithFrame:CGRectMake(0,0,320, 480)];
    [parentView addSubview:overlayView];
    [parentView addSubview:toolBar];
    [parentView addSubview:lbl];
    [parentView addSubview:overlayGraphicView];

    // configure the image picker with our overlay view
    //UIImagePickerController *picker=[[UIImagePickerController alloc] init];

    if ([UIImagePickerController isSourceTypeAvailable:
         UIImagePickerControllerSourceTypeCamera])
    {
        imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;

        // hide the camera controls
        imagePicker.showsCameraControls=NO;

        imagePicker.delegate = self;
        //imagePicker.allowsImageEditing = NO;

        // and put our overlay view in
        imagePicker.cameraOverlayView=parentView;
    }
    else
    {
        imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.delegate = self;
        imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        imagePicker.mediaTypes = [NSArray arrayWithObjects:
                                  (NSString *) kUTTypeImage,
                                  nil];
        imagePicker.allowsEditing = NO;

    }

    [self presentModalViewController:imagePicker animated:YES];

    //Free memory 
    [imagePicker release];//,imagePicker =nil;
    [parentView release], parentView=nil;
    [overlayGraphicView release], overlayGraphicView= nil;
    [lbl release], lbl=nil;
    [overlayView release];//, overlayView =nil;
    [toolBar release], toolBar=nil;
}

any help is highly appreciated

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-06-07T15:21:22+00:00Added an answer on June 7, 2026 at 3:21 pm

    parentView is being created with [alloc [init...]], meaning it’s retained. Then you assign it to the cameraOverlayView property of imagePicker, meaning it gets retained again. You need to release it after you do that assignment.

    (This is almost certainly the cause of the “leak”, but would not cause a “crash”. You say you’re having a crash but don’t describe that at all.)

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

Sidebar

Related Questions

I have tested my app on the ios simulator and using the following code:
I have tested to retrieve configsection data from app config using c# and it
My iphone application has in-app purchases and those have been tested using the iTunes
I am developing an android app. I have tested the app in mobile and
I have an app which was tested thoroughly and working fine on Android Gingerbread
I have tested the below script on a demo page which is not using
I have a web app using thin clients (bosanova terminals) as the front end
Say I have Test assembly (NUnit compliant) App.Test.dll and a library to be tested
I'm starting an Android app which will have multiple Activities. It will be using
I understand we do need an unique APP ID, but seems I have tested

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.