diff options
author | danielk1977 <danielk1977@noemail.net> | 2008-03-28 07:42:53 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2008-03-28 07:42:53 +0000 |
commit | dbdc4d49cbf81aaadfa43f9bb84582f467473aa0 (patch) | |
tree | 2eeab02a79f54e9960173b71bfd217e1bc1e96b9 /src/mem2.c | |
parent | 19db935225bc66eafbc830e3a76262a0d68d870a (diff) | |
download | sqlite-dbdc4d49cbf81aaadfa43f9bb84582f467473aa0.tar.gz sqlite-dbdc4d49cbf81aaadfa43f9bb84582f467473aa0.zip |
If memory is leaked when running a test script with the --malloctrace option, write out a file called leaks.sql in the same format as mallocs.sql containing th e leaked applications. The same tools can then be used to examine the stack traces associated with leaked allocations. (CVS 4926)
FossilOrigin-Name: f1b97ed93183378ff56b4fe7ae8ea269c24092fc
Diffstat (limited to 'src/mem2.c')
-rw-r--r-- | src/mem2.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mem2.c b/src/mem2.c index 56da91462..bacc713f2 100644 --- a/src/mem2.c +++ b/src/mem2.c @@ -12,7 +12,7 @@ ** This file contains the C functions that implement a memory ** allocation subsystem for use by SQLite. ** -** $Id: mem2.c,v 1.23 2008/03/21 14:22:44 danielk1977 Exp $ +** $Id: mem2.c,v 1.24 2008/03/28 07:42:54 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -410,6 +410,15 @@ void sqlite3MemdebugSettitle(const char *zTitle){ sqlite3_mutex_leave(mem.mutex); } +void sqlite3MemdebugSync(){ + struct MemBlockHdr *pHdr; + for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){ + void **pBt = (void**)pHdr; + pBt -= pHdr->nBacktraceSlots; + mem.xBacktrace(pHdr->iSize, pHdr->nBacktrace-1, &pBt[1]); + } +} + /* ** Open the file indicated and write a log of all unfreed memory ** allocations into that log. |