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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:05:49+00:00 2026-05-18T06:05:49+00:00

Instruments point to this line saying there is a leak here – (void) loadFavoriteData

  • 0

Instruments point to this line saying there is a leak here

- (void) loadFavoriteData {
    TradePortMobileAppDelegate *delegate = [[UIApplication sharedApplication] delegate];

    NSManagedObjectContext *context = [delegate managedObjectContext];

    NSManagedObjectModel *objectModel = [[context persistentStoreCoordinator] managedObjectModel];

    Session *session = delegate.session;

    NSDictionary *param = [NSDictionary dictionaryWithObjectsAndKeys: [session objectForKey:@"CTY_CODE"], pCOUNTRY, nil];

    NSFetchRequest *fetchRequest = [objectModel fetchRequestFromTemplateWithName:@"fetchAllFavorites" substitutionVariables:param];

    [fetchRequest setSortDescriptors: self.dataSorter];
    NSError *error;

    //THIS IS THE LINE INSTRUMENT SAYS THERE IS A LEAK!!!!!
    NSMutableArray *favorites = [[context executeFetchRequest:fetchRequest error:&error] mutableCopy];


    if ([favorites count] > 0) {

        [self.favoriteList removeAllObjects];


        for (NSInteger i=0; i < [favorites count]; i++) {
            FavoriteData *favorite = [favorites objectAtIndex: i];

            if (i < vMaxRecordsInCoreData) {

                [self.favoriteList addObject:[FavoriteInfo favoriteInfoWithClientId:favorite.clientId               withName:favorite.name 
                withAddress:favorite.address 
                withPhone:favorite.phone 

    withEmail:favorite.email 

    withCountry:favorite.country 

    withLtpId:favorite.ltpId
                withUpdateTimestamp:favorite.updateTimestamp
                withNoOfDetails:favorite.noOfDetails]];

    }

    else {

    [context deleteObject:favorite];

    }

        }

        if (![context save:&error]) {
            NSLog(@"deleting excess favorites failed.");
        }
        self.navigationItem.leftBarButtonItem.enabled = YES;

    }
    else {
        [self.favoriteList removeAllObjects];
        self.navigationItem.leftBarButtonItem.enabled = NO;
    }

    [favorites removeAllObjects];
    [favorites release];

}

This is the stack

   0 CoreFoundation _CFRuntimeCreateInstance
   1 CoreFoundation __CFStringCreateImmutableFunnel3
   2 CoreFoundation CFStringCreateWithCString
   3 CoreData -[NSSQLCore _prepareResultsFromResultSet:usingFetchPlan:withMatchingRows:]
   4 CoreData -[NSSQLCore _newRowsForFetchPlan:selectedBy:withArgument:]
   5 CoreData -[NSSQLCore newRowsForFetchPlan:]
   6 CoreData -[NSSQLCore objectsForFetchRequest:inContext:]
   7 CoreData -[NSSQLCore executeRequest:withContext:error:]
   8 CoreData -[NSPersistentStoreCoordinator executeRequest:withContext:error:]
   9 CoreData -[NSManagedObjectContext executeFetchRequest:error:]
  MY CODE HERE--->10 TradePortMobile -[FavoritesTableViewController loadFavoriteData] /Users/aldrich/Projects/iPhone/Classes/FavoritesTableViewController.m:281
  11 TradePortMobile -[FavoritesTableViewController viewWillAppear:] /Users/aldrich/Projects/iPhone/Classes/FavoritesTableViewController.m:54
  12 UIKit -[UINavigationController viewWillAppear:]
  13 UIKit -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:]
  14 UIKit -[UITabBarController transitionFromViewController:toViewController:]
  15 UIKit -[UITabBarController _setSelectedViewController:]
  16 UIKit -[UITabBarController _tabBarItemClicked:]
  17 UIKit -[UIApplication sendAction:to:from:forEvent:]
  18 UIKit -[UITabBar _sendAction:withEvent:]
  19 UIKit -[UIApplication sendAction:to:from:forEvent:]
  20 UIKit -[UIControl sendAction:to:forEvent:]
  21 UIKit -[UIControl(Internal) _sendActionsForEvents:withEvent:]
  22 UIKit -[UIControl sendActionsForControlEvents:]
  23 UIKit -[UIApplication sendAction:to:from:forEvent:]
  24 UIKit -[UIControl sendAction:to:forEvent:]
  25 UIKit -[UIControl(Internal) _sendActionsForEvents:withEvent:]
  26 UIKit -[UIControl touchesEnded:withEvent:]
  27 UIKit -[UIWindow _sendTouchesForEvent:]
  28 UIKit -[UIApplication sendEvent:]
  29 UIKit _UIApplicationHandleEvent
  30 GraphicsServices PurpleEventCallback
  31 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
  32 CoreFoundation __CFRunLoopDoSource1
  33 CoreFoundation __CFRunLoopRun
  34 CoreFoundation CFRunLoopRunSpecific
  35 CoreFoundation CFRunLoopRunInMode
  36 GraphicsServices GSEventRunModal
  37 GraphicsServices GSEventRun
  38 UIKit UIApplicationMain
  39 TradePortMobile main /Users/aldrich/Projects/iPhone/main.m:14
  40 TradePortMobile start

May somebody give me a push to the right direction? or an answer to this leak i can not solve 🙂

  • 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-18T06:05:50+00:00Added an answer on May 18, 2026 at 6:05 am

    The leak tool can only point to where the memory has been allocated, the leak is probably happening as you are passing some of the properties of each object from the array in the following code:

    [self.favoriteList addObject:[FavoriteInfo favoriteInfoWithClientId:favorite.clientId               withName:favorite.name 
                    withAddress:favorite.address 
                    withPhone:favorite.phone 
    
        withEmail:favorite.email 
    
        withCountry:favorite.country 
    
        withLtpId:favorite.ltpId
                    withUpdateTimestamp:favorite.updateTimestamp
                    withNoOfDetails:favorite.noOfDetails]];
    

    you need to check what happens with the parameters of favoriteInfoWithClientId:favorite – if you retain any of these then you will have a leak…

    hope this helps

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

Sidebar

Related Questions

I'm using Instruments to try to determine if there are places in my application
Using Instruments on the device it detects a 3.50 KB memory leak using Apple's
why do I need this autorelease after [NSMutableArray array] to avoid a memory leak?
Instruments show me a leak in simulator in the following code, UIBarButtonItem *connectButton =
does an entry in Instruments leaked block during application running imply memory leak? That
The instruments that are used with Guitar Hero and Rock Band have USB connections.
Sampling with Activity Monitor/Instruments/Shark will show stack traces full of C functions for the
I have this snippet of code from a class created by Erica Sadun, that
This is the header: @interface ForumBrowserAppDelegate : NSObject <UIApplicationDelegate> { ForumSelection *forumSelection; UIWindow *window;
I need your help, i'm stacked on this project. When i run my applicaion

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.