0
votes

I tried to change the custom Tab Bar Item image, in interface builder

The image size is 54x58

The application compiles and runs fine ! But when I profile it With Xcode (CMD+I > Leaks) Instruments it shows the following memory leak,

// ... 
Leaked Object   #  Address    Size      Responsible Library   Responsible Frame
Malloc 48 Bytes 1  0xada86a0  48 Bytes  CoreGraphics          CGGlyphBitmapCreate
Malloc 48 Bytes 1  0xe1905d0  48 Bytes  CoreGraphics          CGGlyphBitmapCreate
Malloc 32 Bytes 1  0xad96170  32 Bytes  CoreGraphics          C

// .... 

The Stack trace doesn't show any of my code leaking, The problem also can be triggered by simply setting the custom background images for NavigationBar or TabBar in AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    // Some Look and Feel 
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav_bg"]];

    [[UINavigationBar appearance] setBackgroundImage:navbar_bkg_image
                                       forBarMetrics:UIBarMetricsDefault];
 // where navbar_bkg_image is UIImage 

    return YES;
}

Any suggestion ?

2
I suspect this leak is unrelated to UINavigationBar and/or UITabBar. I see the same leaks when just using UIImageView. This is annoying, but not anything you need to worry about.Rob
Yes, it is actually annoying, especially if you didn't know it.abdimuna

2 Answers

0
votes

This is a known bug when employing UIImageView in iOS 7.0. So the problem is probably not a result of the tab bar or navigation bar, but rather the UIImageView objects that they both employ. If the reported leaks go away when you comment out those lines, you can probably safely disregard the leaks (we can only control what we do, not leaks generated by iOS 7, itself).

Having said that, re-testing this in iOS 7.0.3 (Xcode Version 5.0.1 5A2053), it looks like Apple may have fixed this issue.

-1
votes

Try using @autoreleasepool, it will solve your problem.