On 06/06/2015 03:19 AM, George wrote: > 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):
I guess that assert() failing means the heap is corrupted. Which might be SQLite related or might not. Running the app under [valgrind] might tell you more. Post its complete output here if there are errors but it's not obvious what the problem is. Dan. > > 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