On Apr 7, 2009, at 10:45 AM, Tom Broadbent wrote:

> hello -
>
> i'm using SQLite in an embedded application (WinCE) and i'm running  
> into what appears to a heap corruption issue.  the access violation  
> happens at the following line (in pcache1Fetch):
>
> for(pPage=pCache->apHash[h]; pPage&&pPage->iKey!=iKey; pPage=pPage- 
> >pNext);
>
> mostly i'm curious what others have experienced relating to heap  
> corruption and SQLite.  the bad address that is causing the AV  
> appears to be UNICODE (ascii-range bytes, 0x00, ascii-range bytes,  
> 0x00).  i realize this isn't much to work w/ but mostly i'm  
> interested in a) others' experiences w/ this type of problem, b)  
> hints to find the cause of the heap corruption, and c) tools that  
> work w/ WinCE for detecting heap corruption (i've looked into  
> CodeSnitch a bit).
>
> i'm running a vanilla version 3.6.6.2 w/ SQLITE_OS_WINCE,  
> SQLITE_OMIT_LOCALTIME.

Compiling with both SQLITE_DEBUG and SQLITE_MEMDEBUG adds a bunch of
checks to each call to malloc() and free() that SQLite makes. If
SQLite is corrupting the heap itself it is likely an assert() will
fail during one of these checks. The stack trace might make it clearer
what is going on.

Also, you could try using the SQLITE_CONFIG_HEAP feature to configure
SQLite with its own private heap space by calling sqlite3_config()
before any other API:

   static u8 heap[1024*1024];
   sqlite3_config(heap, 1024*1024, 32);

If it is not SQLite corrupting the heap (it could be other parts of
the app), then the crash will likely occur in some other sub-system
when SQLite is configured this way.

Dan.


> thanks
> tom
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to