diff options
author | danielk1977 <danielk1977@noemail.net> | 2008-03-25 09:47:35 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2008-03-25 09:47:35 +0000 |
commit | cd3e8f7ce94b2c87ceeeb3da3e2344e1397ec2ab (patch) | |
tree | 6c4d2fa51268edffef783bec9a2f9c689871b82e /src/vdbeaux.c | |
parent | 1e968a0cbf30ea1b0f4d4c5927a8b173d36956d9 (diff) | |
download | sqlite-cd3e8f7ce94b2c87ceeeb3da3e2344e1397ec2ab.tar.gz sqlite-cd3e8f7ce94b2c87ceeeb3da3e2344e1397ec2ab.zip |
Use a vdbe memory cell to allocate the space required for vdbe cursors. (CVS 4912)
FossilOrigin-Name: 047153648155654b0cd70b811935209d2e21776c
Diffstat (limited to 'src/vdbeaux.c')
-rw-r--r-- | src/vdbeaux.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/vdbeaux.c b/src/vdbeaux.c index be7c27642..7e7824a01 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -958,6 +958,17 @@ void sqlite3VdbeMakeReady( */ p->magic = VDBE_MAGIC_RUN; + /* For each cursor required, also allocate a memory cell. Memory + ** cells (nMem+1-nCursor)..nMem, inclusive, will never be used by + ** the vdbe program. Instead they are used to allocate space for + ** Cursor/BtCursor structures. The blob of memory associated with + ** cursor 0 is stored in memory cell nMem. Memory cell (nMem-1) + ** stores the blob of memory associated with cursor 1, etc. + ** + ** See also: allocateCursor(). + */ + nMem += nCursor; + /* ** Allocation space for registers. */ @@ -1026,8 +1037,8 @@ void sqlite3VdbeMakeReady( } /* -** Close a VDBE cursor and release all the resources that cursor happens -** to hold. +** Close a VDBE cursor and release all the resources that cursor +** happens to hold. */ void sqlite3VdbeFreeCursor(Vdbe *p, Cursor *pCx){ if( pCx==0 ){ @@ -1051,8 +1062,9 @@ void sqlite3VdbeFreeCursor(Vdbe *p, Cursor *pCx){ } #endif sqlite3_free(pCx->pData); - sqlite3_free(pCx->aType); - sqlite3_free(pCx); + memset(pCx, 0, sizeof(Cursor)); + /* sqlite3_free(pCx->aType); */ + /* sqlite3_free(pCx); */ } /* @@ -1084,6 +1096,7 @@ static void Cleanup(Vdbe *p){ for(i=1; i<=p->nMem; i++){ MemSetTypeFlag(&p->aMem[i], MEM_Null); } + releaseMemArray(&p->aMem[1], p->nMem); sqlite3VdbeFifoClear(&p->sFifo); if( p->contextStack ){ |