Note that there are some explanatory texts on larger screens.

plurals
  1. POiphone sqlite3 object allocation memory up but no leaks
    text
    copied!<p>i've been trying to figure out wh. sqy my object allocation keeps rigth up every time i call this function, Instruments reports no leaks but I get a heck of a lot of object coming from </p> <pre><code>sqlite3_exec --&gt; sqlite3Prepare --&gt; sqlite3Parser --&gt; yy_reduce --&gt; malloc &amp; also a whole bunch from &amp; from sqlite3Step --&gt; sqlite3VdbeExec --&gt; sqlite3BtreeInsert --&gt; malloc </code></pre> <p>I tried solving it by following the suggestions posted here: <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/7092-sqlite3-database-gobbling-up-memory.html" rel="nofollow noreferrer">http://www.iphonedevsdk.com/forum/iphone-sdk-development/7092-sqlite3-database-gobbling-up-memory.html</a> but haven't been able to fix it</p> <p>ANY HELP is appreciated, my code is below</p> <pre><code>+(void)getDesignationsInLibrary:(NSString *)library { NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init]; NSString *dbName = @"s8.sqlite"; NSArray *documentPaths = \ NSSearchPathForDirectoriesInDomains \ (NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDir = \ [documentPaths objectAtIndex:0]; NSString *databasePath = \ [documentsDir stringByAppendingPathComponent:dbName]; [[DT sharedDT].designationsInLibrary removeAllObjects]; NSString *sqlString; for(int i=0;i&lt;[[DT sharedDT].typesInLibrary count];i++) { if(sqlite3_open([databasePath UTF8String], &amp;db)==SQLITE_OK) { if (sqlite3_exec(db, "PRAGMA CACHE_SIZE=50;", NULL, NULL, NULL) != SQLITE_OK) { NSAssert1(0, @"Error: failed to set cache size with message '%s'.", sqlite3_errmsg(db)); } NSMutableString *lib=[NSMutableString stringWithString:library]; [lib appendString:@"-"]; [lib appendString:[[DT sharedDT].typesInLibrary objectAtIndex:i]]; if([DT sharedDT].sortedBy==@"AISC Default") { sqlString = [NSString stringWithFormat:@"select DESIGNATION from \"%@\";",lib]; } else { sqlString = [NSString stringWithFormat:@"select DESIGNATION from \"%@\" order by cast(%@ as numeric) %@;",lib, [DT sharedDT].sortedBy, [DT sharedDT].sortAscDesc]; } const char *sql = [sqlString cStringUsingEncoding:NSASCIIStringEncoding]; sqlite3_stmt *selectstmt; if(sqlite3_prepare_v2(db,sql,-1,&amp;selectstmt, NULL)==SQLITE_OK) { while(sqlite3_step(selectstmt)==SQLITE_ROW) { [[DT sharedDT].designationsInLibrary addObject:[NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt,0)]]; } sqlite3_finalize(selectstmt); selectstmt=nil; } } } sqlite3_close(db); [localPool release]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload