-C Change\sthe\sway\stoken\smemory\sis\sallocated\sin\san\seffort\sto\sfix\sticket\s#136.\nThere\sis\snow\sa\smemory\sleak\swhen\susing\sviews\sof\sviews.\s(CVS\s725)
-D 2002-08-24T18:24:52
+C Fix\sthe\smemory\sleak\sintroduced\sby\scheck-in\s(725).\s(CVS\s726)
+D 2002-08-25T18:29:12
F Makefile.in bcb81f40d9a17bd94f59e67157b1e1c54c046c2b
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/parse.y 1b180e14b6346e323bd4279469748716f412cc1c
F src/printf.c 5c50fc1da75c8f5bf432b1ad17d91d6653acd167
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
-F src/select.c 7aa3c3784452ca8f154ae9b3b250ccedc1633354
+F src/select.c bef25919ad813685d60d03a393728bf5766ec0cb
F src/shell.c 9e9a6eb6bca07f01e6472a603f908a0127ea50ff
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in d3999a9c6374675779058d6cfe5431131618e92b
F src/tokenize.c 8bd6251e5237c9a16d0bbfb9894925eb129985fa
F src/trigger.c cc8c6769c2ca37166490ed2b305986268faa3bf8
F src/update.c f07e6ed2c517c92871e54d3f5886d1cf56121b11
-F src/util.c bdbf0aedcec21ede2248126bbbe734bcc070b7c8
-F src/vdbe.c 5b3bb8ac3bb8dd777abd9fae64a293bfdcc13c54
+F src/util.c 60bc91db77cf488618ec4720cb06eedb7f959268
+F src/vdbe.c 92bcd4661641fba76680c762971bdca7995594d6
F src/vdbe.h a9292f2b5fcecef924fa255fb74609e9cbc776c2
F src/where.c ce42cce65d7bf42341627f3fb0a17f69fea6a4f4
F test/all.test efd958d048c70a3247997c482f0b33561f7759f0
F test/update.test 7ffb062d580a972e7870d0f51d5af3ab9bfeae08
F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe
F test/version.test c7057526e14c7e3da5718b88e7f566f4182fd5c5
-F test/view.test e4d60d68ea3965fe0cc8fa83ba9aa42e23199801
+F test/view.test ed18cebaa19fa949cad4bc7e7f2d8d71001153cf
F test/where.test c7aba40ad9178acf9c898e53aac9e447e2d2f2f7
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/lemon.c 022adc2830c2705828f744d2c59798bd462eb465
F tool/lempar.c 73a991cc3017fb34804250fa901488b5147b3717
-F tool/memleak.awk 296dfbce7a9ca499b95ce04e30334e64a50052e0
+F tool/memleak.awk 16ef9493dcd36146f806e75148f4bb0201a123ec
F tool/opNames.awk 5ba1f48aa854ee3b7c3d2b54233665bc3e649ea2
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
F tool/renumberOps.awk 6d067177ad5f8d711b79577b462da9b3634bd0a9
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 97fc4a71a12b52cda67b5192c3bd7bd10ac0c7a6
-R e9cbaf493a319211c9d9a2010395d53a
+P 22d8726e61eec0e53893f492cb2163824b87a23e
+R 4234452349011dbb44aad5f2e4ed57e1
U drh
-Z df71dce9abf1e8c9e6b3a2493526cd33
+Z 4b5d6fc436ecc6188dd50e32ce24f78e
-22d8726e61eec0e53893f492cb2163824b87a23e
\ No newline at end of file
+b957dafc26383af514795df18bc7b8f367c9bd21
\ No newline at end of file
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
-** $Id: select.c,v 1.108 2002/08/24 18:24:54 drh Exp $
+** $Id: select.c,v 1.109 2002/08/25 18:29:12 drh Exp $
*/
#include "sqliteInt.h"
if( sqliteViewGetColumnNames(pParse, pTab) ){
return 1;
}
+ sqliteSelectDelete(pTabList->a[i].pSelect);
pTabList->a[i].pSelect = sqliteSelectDup(pTab->pSelect);
}
}
pNew = pEList->a[pExpr->iColumn].pExpr;
assert( pNew!=0 );
pExpr->op = pNew->op;
+ assert( pExpr->pLeft==0 );
pExpr->pLeft = sqliteExprDup(pNew->pLeft);
+ assert( pExpr->pRight==0 );
pExpr->pRight = sqliteExprDup(pNew->pRight);
+ assert( pExpr->pList==0 );
pExpr->pList = sqliteExprListDup(pNew->pList);
pExpr->iTable = pNew->iTable;
pExpr->iColumn = pNew->iColumn;
}
pSrc->a[iFrom].pTab = pSubSrc->a[0].pTab;
pSubSrc->a[0].pTab = 0;
+ assert( pSrc->a[iFrom].pSelect==pSub );
pSrc->a[iFrom].pSelect = pSubSrc->a[0].pSelect;
pSubSrc->a[0].pSelect = 0;
sqliteSelectDelete(pSub);
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
-** $Id: util.c,v 1.48 2002/08/13 23:02:57 drh Exp $
+** $Id: util.c,v 1.49 2002/08/25 18:29:12 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
int sqlite_nMalloc; /* Number of sqliteMalloc() calls */
int sqlite_nFree; /* Number of sqliteFree() calls */
int sqlite_iMallocFail; /* Fail sqliteMalloc() after this many calls */
+#if MEMORY_DEBUG>1
+static int memcnt = 0;
+#endif
/*
p = &pi[2];
memset(p, 0, n);
#if MEMORY_DEBUG>1
- fprintf(stderr,"malloc %d bytes at 0x%x from %s:%d\n", n, (int)p, zFile,line);
+ fprintf(stderr,"%06d malloc %d bytes at 0x%x from %s:%d\n",
+ ++memcnt, n, (int)p, zFile,line);
#endif
return p;
}
}
memset(pi, 0xff, (k+3)*sizeof(int));
#if MEMORY_DEBUG>1
- fprintf(stderr,"free %d bytes at 0x%x from %s:%d\n", n, (int)p, zFile,line);
+ fprintf(stderr,"%06d free %d bytes at 0x%x from %s:%d\n",
+ ++memcnt, n, (int)p, zFile,line);
#endif
free(pi);
}
memset(oldPi, 0, (oldK+3)*sizeof(int));
free(oldPi);
#if MEMORY_DEBUG>1
- fprintf(stderr,"realloc %d to %d bytes at 0x%x to 0x%x at %s:%d\n", oldN, n,
- (int)oldP, (int)p, zFile, line);
+ fprintf(stderr,"%06d realloc %d to %d bytes at 0x%x to 0x%x at %s:%d\n",
+ ++memcnt, oldN, n, (int)oldP, (int)p, zFile, line);
#endif
return p;
}
** But other routines are also provided to help in building up
** a program instruction by instruction.
**
-** $Id: vdbe.c,v 1.169 2002/08/15 01:26:10 drh Exp $
+** $Id: vdbe.c,v 1.170 2002/08/25 18:29:13 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
Keylist **keylistStack; /* The stack used by opcodes ListPush & ListPop */
};
+/*
+** When debugging the code generator in a symbolic debugger, on can
+** set the sqlite_vdbe_addop_trace to 1 and all opcodes will be printed
+** as they are added to the instruction stream.
+*/
+#ifndef NDEBUG
+int sqlite_vdbe_addop_trace = 0;
+static void vdbePrintOp(FILE*, int, Op*);
+#endif
+
/*
** Create a new virtual database engine.
*/
p->aOp[i].p2 = p2;
p->aOp[i].p3 = 0;
p->aOp[i].p3type = P3_NOTUSED;
+#ifndef NDEBUG
+ if( sqlite_vdbe_addop_trace ) vdbePrintOp(0, i, &p->aOp[i]);
+#endif
return i;
}
p->aOp[i+addr] = aOp[i];
if( p2<0 ) p->aOp[i+addr].p2 = addr + ADDR(p2);
p->aOp[i+addr].p3type = aOp[i].p3 ? P3_STATIC : P3_NOTUSED;
+#ifndef NDEBUG
+ if( sqlite_vdbe_addop_trace ) vdbePrintOp(0, i+addr, &p->aOp[i+addr]);
+#endif
}
p->nOp += nOp;
}
return i>0 ? zBuf : 0;
}
+#ifndef NDEBUG
+/*
+** Print a single opcode. This routine is used for debugging only.
+*/
+static void vdbePrintOp(FILE *pOut, int pc, Op *pOp){
+ char *zP3;
+ char zPtr[40];
+ if( pOp->p3type==P3_POINTER ){
+ sprintf(zPtr, "ptr(%#x)", (int)pOp->p3);
+ zP3 = zPtr;
+ }else{
+ zP3 = pOp->p3;
+ }
+ if( pOut==0 ) pOut = stdout;
+ fprintf(pOut,"%4d %-12s %4d %4d %s\n",
+ pc, zOpName[pOp->opcode], pOp->p1, pOp->p2, zP3 ? zP3 : "");
+ fflush(pOut);
+}
+#endif
+
/*
** Execute the program in the VDBE.
**
*/
#ifndef NDEBUG
if( p->trace ){
- char *zP3;
- char zPtr[40];
- if( pOp->p3type==P3_POINTER ){
- sprintf(zPtr, "ptr(%#x)", (int)pOp->p3);
- zP3 = zPtr;
- }else{
- zP3 = pOp->p3;
- }
- fprintf(p->trace,"%4d %-12s %4d %4d %s\n",
- pc, zOpName[pOp->opcode], pOp->p1, pOp->p2, zP3 ? zP3 : "");
- fflush(p->trace);
+ vdbePrintOp(p->trace, pc, pOp);
}
#endif
# This file implements regression tests for SQLite library. The
# focus of this file is testing VIEW statements.
#
-# $Id: view.test,v 1.9 2002/08/24 18:24:57 drh Exp $
+# $Id: view.test,v 1.10 2002/08/25 18:29:16 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
SELECT * FROM v6 ORDER BY xyz;
}
} {7 2 13 5 19 8 27 12}
-if 0 {
do_test view-8.2 {
db close
sqlite db test.db
SELECT * FROM v7 ORDER BY a;
}
} {9 18 27 39}
+if 0 {
do_test view-8.4 {
execsql { PRAGMA vdbe_trace=on;
CREATE VIEW v8 AS SELECT max(cnt) FROM
# This script looks for memory leaks by analyzing the output of "sqlite"
# when compiled with the MEMORY_DEBUG=2 option.
#
-/^malloc / {
- mem[$5] = $0
+/[0-9]+ malloc / {
+ mem[$6] = $0
}
-/^realloc / {
- mem[$7] = "";
- mem[$9] = $0
+/[0-9]+ realloc / {
+ mem[$8] = "";
+ mem[$10] = $0
}
-/^free / {
- mem[$5] = "";
- str[$5] = ""
+/[0-9]+ free / {
+ mem[$6] = "";
+ str[$6] = ""
}
/^string at / {
- addr = $3
+ addr = $4
sub("string at " addr " is ","")
str[addr] = $0
}