Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | The prior fix of ticket #360 was incorrect and caused a memory leak. This check-in plugs the memory leak and correctly fixes ticket #360. (CVS 1040) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
fc490f677b89e623b41f9e7f5f3bade9 |
User & Date: | drh 2003-06-29 20:25:08.000 |
Context
2003-06-29
| ||
20:45 | Version 2.8.4 (CVS 1041) (check-in: 7f5e8894ae user: drh tags: trunk) | |
20:25 | The prior fix of ticket #360 was incorrect and caused a memory leak. This check-in plugs the memory leak and correctly fixes ticket #360. (CVS 1040) (check-in: fc490f677b user: drh tags: trunk) | |
18:29 | Fix a bad memory leak in the in-memory database module. (CVS 1039) (check-in: 9cca959378 user: drh tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
32 33 34 35 36 37 38 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** ** $Id: vdbe.c,v 1.231 2003/06/29 20:25:08 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** The makefile scans this source file and creates the following |
︙ | ︙ | |||
975 976 977 978 979 980 981 | char **pzStack = &p->zStack[i]; char *z; assert( (pStack->flags & STK_Ephem)!=0 ); z = sqliteMallocRaw( pStack->n ); if( z==0 ) return 1; memcpy(z, *pzStack, pStack->n); *pzStack = z; | | > | 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 | char **pzStack = &p->zStack[i]; char *z; assert( (pStack->flags & STK_Ephem)!=0 ); z = sqliteMallocRaw( pStack->n ); if( z==0 ) return 1; memcpy(z, *pzStack, pStack->n); *pzStack = z; pStack->flags &= ~STK_Ephem; pStack->flags |= STK_Dyn; return 0; } /* ** Release the memory associated with the given stack level */ #define Release(P,I) if((P)->aStack[I].flags&STK_Dyn){ hardRelease(P,I); } |
︙ | ︙ |
Changes to test/misc2.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for miscellanous features that were # left out of other test files. # | | > > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for miscellanous features that were # left out of other test files. # # $Id: misc2.test,v 1.3 2003/06/29 20:25:09 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test for ticket #360 # do_test misc2-1.1 { catchsql { CREATE TABLE FOO(bar integer); CREATE TRIGGER foo_insert BEFORE INSERT ON foo BEGIN SELECT CASE WHEN (NOT new.bar BETWEEN 0 AND 20) THEN raise(rollback, 'aiieee') END; END; INSERT INTO foo(bar) VALUES (1); } } {0 {}} do_test misc2-1.2 { catchsql { INSERT INTO foo(bar) VALUES (111); } } {1 aiieee} # Make sure ROWID works on a view and a subquery. Ticket #364 # do_test misc2-2.1 { execsql { CREATE TABLE t1(a,b,c); |
︙ | ︙ |
Added tool/memleak2.awk.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # This AWK script reads the output of testfixture when compiled for memory # debugging. It generates SQL commands that can be fed into an sqlite # instance to determine what memory is never freed. A typical usage would # be as follows: # # make -f memleak.mk fulltest 2>mem.out # awk -f ../sqlite/tool/memleak2.awk mem.out | ./sqlite :memory: # # The job performed by this script is the same as that done by memleak.awk. # The difference is that this script uses much less memory when the size # of the mem.out file is huge. # BEGIN { print "CREATE TABLE mem(loc INTEGER PRIMARY KEY, src);" } /[0-9]+ malloc / { print "INSERT INTO mem VALUES(" strtonum($6) ",'" $0 "');" } /[0-9]+ realloc / { print "INSERT INTO mem VALUES(" strtonum($10) \ ",(SELECT src FROM mem WHERE loc=" strtonum($8) "));" print "DELETE FROM mem WHERE loc=" strtonum($8) ";" } /[0-9]+ free / { print "DELETE FROM mem WHERE loc=" strtonum($6) ";" } END { print "SELECT src FROM mem;" } |