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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:25:01+00:00 2026-06-06T00:25:01+00:00

Hi everyone, I’m stuck these days on some memory leaks. The app I’m making

  • 0

Hi everyone,

I’m stuck these days on some memory leaks. The app I’m making is working like that :

1 – Loads a file into memory
2 – Create a screen according to some values read on that file
3 – Display the view

Far from now everything is normal when I start the app and get the first screen. There is no leaks.

But when I want to load an other screen from the current view I got plenty of leaks from autoreleased objects. And I don’t understand because when I load a new view from the current one the process is similar :

1 – Desctruction of the current view
2 – Loads a file into memory
3 – Create a screen according to some values read on that file
4 – Display the view

Here are some concrete example of what is leaking :

-(NSString*)pathForApplicationName:(NSString*)appName
                         withImage:(NSString*)imagePath { 
       NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,    NSUserDomainMask, YES);
       NSString *documentPath = [searchPaths lastObject];
       return [NSString stringWithFormat:@"%@/%@/assets/www/%@",documentPath,[self convertSpacesInDashes:appName],imagePath];
 }

The stringWithFormat:.. is leaking. An other example :

-(UIColor*)convertHexColorToUIColor:(NSString*)hexColor {

    if ([hexColor length] == 7) {
        unsigned c = 0;
        NSScanner *scanner = [NSScanner scannerWithString:hexColor];
        [scanner setScanLocation:1];
        [scanner scanHexInt:&c];


        return [UIColor colorWithRed:((c>>16)&0xFF)/255.0 
                               green:((c>>8)&0xFF)/255.0 
                                blue:(©&0xFF)/255.0 
                               alpha:1.];
    }
    else {
        return nil;
    }
}

Same, colorWithRed:.. is leaking.

I’ve read apple’s documentation regarding autoreleased objects. And I’ve even tried to recreate a new pool like that, without any success :

-(UIView)myFonctionWhoGenerateScreens:

    for () {

        NSAutoreleasePool *subPool = [[NSAutoreleasePool alloc] init];

        // There are all of the autoreleased method calls that are leaking...

        [subPool drain];

    }    
}

I think I am missing something. Does anyone has an idea?

Leak backtrace enter image description here

Thanks a lot.

Edit :

Here is how the return of the leaking function is handled in applyPropertyName:withPropertyType:onComponent:withValue:forStyling method :

else if ([propertyType isEqualToString:@"AB_IMAGE"]) {

        UIImage *image = [UIImage imageWithContentsOfFile:[self pathForApplicationName:applicationName
                                                                             withImage:value]];
        @try {
            [component setValue:image
                         forKey:propertyName];
        }
        @catch (NSException *exception) {
#if DEBUG_CONTROLLER
            NSLog(@" %@ Not key-value compliant for <%@,%@>",component,propertyName,image);
#endif
        }
    }

Edit 2 :
Here is the complete back trace http://ganzolo.free.fr/leak/%20Leak.zip

  • 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-06T00:25:03+00:00Added an answer on June 6, 2026 at 12:25 am

    Looking at your Leak document, and picking the [NSString stringWithFormat] object at address 0xdec95c0 as an example, it shows balanced retain count operations for the Foundation, ImageIO, and CoreGraphics use of the object but ABTwoImageItemImageLeftComponent is still holding an unreleased reference.

    0   0xdec95c0   CFString (immutable)    Malloc  1   00:39.994.343   144 Foundation  +[NSString stringWithFormat:]
    1   0xdec95c0   CFString (immutable)    Autorelease <null>  00:39.994.376   0   Foundation  +[NSString stringWithFormat:]
    2   0xdec95c0   CFString (immutable)    CFRetain    2   00:39.994.397   0   iOS Preview App -[ABTwoImageItemImageLeftComponent setSrcProperty:]
    3   0xdec95c0   CFString (immutable)    CFRetain    3   00:39.996.231   0   ImageIO CGImageReadCreateWithFile
    4   0xdec95c0   CFString (immutable)    CFRetain    4   00:39.998.012   0   CoreGraphics    CGPropertiesSetProperty
    5   0xdec95c0   CFString (immutable)    CFRelease   3   00:40.362.865   0   Foundation  -[NSAutoreleasePool release]
    6   0xdec95c0   CFString (immutable)    CFRelease   2   01:14.892.330   0   CoreGraphics    CGPropertiesRelease
    7   0xdec95c0   CFString (immutable)    CFRelease   1   01:14.892.921   0   ImageIO releaseInfoJPEG
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

everyone. 1) I've always thought that if I leave my app through Home button
everyone. Please see example below. I'd like to supply a string to 'schedule_action' method
everyone! new to here and been pondering about this myself for some times with
everyone! I try to update values in .resx file with ResXResourceWriter and the value
Everyone, I am a newbie to android development. Now I have a question that
everyone. Here is a small VBA (Excel) function that i wrote, full of MsgBoxes
Everyone likes to talk about reusability. Where I work, whenever some new idea is
everyone, I've started working yesterday on the Euler Project in Clojure and I have
everyone..i want after i type 0203-ED in textfield ...two character behind that text can
Everyone who's done any web application development in Scala knows that you can use

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.