What embedded OS are you using? {Perhaps your INIT and SHUTDOWN procedures/code is incorrect}.
If you are not using an embedded OS, why are you calling sqlite3_initialize and sqlite3_shutdown? You do realize that the purpose of sqlite3_shutdown is to indicate that you no longer require the use of the sqlite engine in the current process because you are, well, finished with it? > -----Original Message----- > From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users- > bounces at mailinglists.sqlite.org] On Behalf Of George > Sent: Friday, 5 June, 2015 14:19 > To: sqlite-users at mailinglists.sqlite.org > Subject: [sqlite] Newbie issue - Linux error malloc.c:2372: sysmalloc: > Assertion `(old_top == (((mbinptr) (((char *) > > Hello everyone, > > I am new to the list. I am working on an application in which I will be > embedding SQLite as the database engine. The application is written in > C. > > I am currently having an issue which I am not able to resolve at the > moment so I thought I would ask here since I am just starting out with > SQLite. > > My problem is, from my point of view, that I am not able to perform an > action to the same database file in the following manner: > > 1) I open a database via: > sqlite3_initialize() > sqlite3_open_v2 > 2) I do some work on getting metadata from the database like table > names and their fields and then > 3) I close the connection via: > sqlite3_close_v2 > sqlite3_shutdown > 4) After all of this is done I wish to process an import file so I need > to open another connection to the same database file and run some > statements but when I try to do that I get this on the open call in > step 1 (above): > > malloc.c:2372: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) > &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct > malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) > >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, > >fd_nextsize))+((2 *(sizeof(size_t)) < __alignof__ (long double) ? > >__alignof__ (long double) : 2 *(sizeof(size_t))) - 1)) & ~((2 > >*(sizeof(size_t)) < __alignof__ (long double) ? __alignof__ (long > >double) : 2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && > >((unsigned long) old_end & pagemask) == 0)' failed. Aborted (core > >dumped) > > This happens in on line 17149 when calling: > > p = SQLITE_MALLOC( nByte+8 ) > > nByte is 64000 > > in sqlite3.c (amalgamation latest version > sqlite-amalgamation-3081002.zip) > > I am compiling and running the code on: > Linux x140e 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:28 UTC > 2015 i686 athlon i686 GNU/Linux > > NAME="Ubuntu" > VERSION="14.04.2 LTS, Trusty Tahr" > ID=ubuntu > ID_LIKE=debian > PRETTY_NAME="Ubuntu 14.04.2 LTS" > VERSION_ID="14.04" > HOME_URL="http://www.ubuntu.com/" > SUPPORT_URL="http://help.ubuntu.com/" > BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" > > I have compiled sqlite.o with the following: > > gcc -c -Wall -O0 -g -std=c99 -Dlinux -I/usr/local/include sqlite3.c \ > -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION -o obj/sqlite3.o > > Any suggestions or directions greatly appreciated. > TIA, > George > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users