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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:34:43+00:00 2026-05-23T14:34:43+00:00

I am getting memory leaks in Instruments in the following Sqlite Code. NSArray *result

  • 0

I am getting memory leaks in Instruments in the following Sqlite Code.

NSArray *result = [self executeQuery:sql arguments:argsArray];

It calls following method.

- (NSArray *)executeQuery:(NSString *)sql arguments:(NSArray *)args {
sqlite3_stmt *sqlStmt;

if (![self prepareSql:sql inStatament:(&sqlStmt)])
    return nil;

int i = 0;
int queryParamCount = sqlite3_bind_parameter_count(sqlStmt);
while (i++ < queryParamCount)
    [self bindObject:[args objectAtIndex:(i - 1)] toColumn:i inStatament:sqlStmt];

NSMutableArray *arrayList = [[NSMutableArray alloc] init];
int columnCount = sqlite3_column_count(sqlStmt);
while ([self hasData:sqlStmt]) {
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    for (i = 0; i < columnCount; ++i) {
        id columnName = [self columnName:sqlStmt columnIndex:i];
        id columnData = [self columnData:sqlStmt columnIndex:i];
        [dictionary setObject:columnData forKey:columnName];
    }
    [arrayList addObject:[dictionary autorelease]];
}

sqlite3_finalize(sqlStmt);

return arrayList;
}

How do I solve it ?

  • 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-23T14:34:43+00:00Added an answer on May 23, 2026 at 2:34 pm

    We’d need to see the code of your executeQuery method – it should be returning an auto-released result, but perhaps it isn’t.

    You could try ;

    NSArray *result = [[self executeQuery:sql arguments:argsArray] autorelease];
    

    But I’d be wary of just blindly trying that without actually seeing what executeQuery does in detail.

    EDIT:

    OK, here’s your problem;

    NSMutableArray *arrayList = [[NSMutableArray alloc] init];
    

    Either create it as an auto-released array, or finish the method with;

    return [arrayList autorelease];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a reported memory leak from Instruments on the following code: NSArray *array
Hi all i am getting memory leaks with following lines of code .how to
Hi I am getting memory leak in Instruments for the following line of code
i am getting following memory leaks for webview initWebUILocalStorageSupport MobileQuickLookLibrary() and here is my
When i run the instrument tool i'm getting memory leaks in the following lines,(NSString
I'm getting an instruments Memory Leak with this iPhone 3.0 SDK code. I'm using
Iam getting memory leaks in below code. Is this is the proper way to
I am getting memory leak in instruments in the code -(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSAutoreleasePool
Using Instruments, I keep on getting pointed to a memory leak with a UIImage.
So Instruments tells me I have three memory leaks originating in this method (specifically,

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.