On 12 Mar 2015, at 4:21pm, Matthias Schmitt <freak002 at mmp.lu> wrote:
> - The memory leak appears in the iPhone simulator more often, than on an > original iPhone device, but it appears always. > > - The leak appears with totally different type of queries. It might be, that > a leak appears in a specific query in one debug session and in another debug > session, it doesn?t (which makes it difficult to debug and drives me totally > nuts). For me it seems to be related to a timing/threading issue. This is why > it makes not much sense to offer some code here. > > - When debugging inside sqlite the leak is always related to the same code > line, independent from the type of database command (select, insert, delete). Is it, by any chance, always the first SQL command executed after doing sqlite3_open() ? > - It appears always with the memory allocation in sqlite.c line 16872 in > function sqlite3MemMalloc > Here is the line: void *p = SQLITE_MALLOC( nByte ); > > - The leaked memory has always a size of nByte = 4344 bytes. Is there any chance you can look at this memory and see what appears there ? Do the extra 4344 bytes get included in the number shown by "sqlite3_memory_used()" ? You could try using that function after sqlite_close() and see what it shows. Is the memory released at any later time ? When you use _close() on the connection, for example ? Or, if you can track it, when SQLite calls "sqlite3_db_release_memory()" internally ? Simon.