how to solve Error calling sqlite3_step (21: out of memory) rs in FMDB

Check for the [rs close];

May be it is releasing or closing the DB.

===================================================

Better use CoreData to implement sqlite in your application.

Why to use external library, when a better internal library is available in the Application. You don't need to remove your sqlite table. You can easily migrate your existing database to CoreData.


I was getting same error because call [database close] before call [resultSet next].

FMDatabase *db;

[db open];

FMResultSet *set = [db executeQuery:@"some select"];

[db close];

while ([set next])
{
    // get Error calling sqlite3_step (21: out of memory) rs
}

[set close];

Should call [database close] after call [resultSet next]

FMDatabase *db;

[db open];

FMResultSet *set = [db executeQuery:@"some select"];

while ([set next])
{
    // no error
}

[set close];
[db close];