1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-09 14:21:03 +03:00

Fix a bug with internally saving cursors open on index tables. Also increase coverage of util.c and btree.c. (CVS 2976)

FossilOrigin-Name: a628d84d3185fb7742cc929e758bfd59c811ca0b
This commit is contained in:
danielk1977
2006-01-19 07:18:14 +00:00
parent e7823cb591
commit 191c3e7db0
6 changed files with 61 additions and 56 deletions

View File

@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.178 2006/01/18 18:22:43 danielk1977 Exp $
** $Id: util.c,v 1.179 2006/01/19 07:18:14 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -392,13 +392,14 @@ static void relinkAlloc(void *p)
** Todo: We could have a version of this function that outputs to stdout,
** to debug memory leaks when Tcl is not available.
*/
#ifdef TCLSH
#if defined(TCLSH) && defined(SQLITE_DEBUG) && SQLITE_MEMDEBUG>1
#include <tcl.h>
int sqlite3OutstandingMallocs(Tcl_Interp *interp){
void *p;
Tcl_Obj *pRes = Tcl_NewObj();
Tcl_IncrRefCount(pRes);
for(p=sqlite3_pFirst; p; p=((void **)p)[1]){
Tcl_Obj *pEntry = Tcl_NewObj();
Tcl_Obj *pStack = Tcl_NewObj();
@@ -443,8 +444,8 @@ int sqlite3OutstandingMallocs(Tcl_Interp *interp){
*/
static void * OSMALLOC(int n){
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
ThreadData const *pTsd = sqlite3ThreadDataReadOnly();
sqlite3_nMaxAlloc = MAX(sqlite3_nMaxAlloc, pTsd->nAlloc);
sqlite3_nMaxAlloc =
MAX(sqlite3_nMaxAlloc, sqlite3ThreadDataReadOnly()->nAlloc);
#endif
assert( !sqlite3_mallocDisallowed );
if( !sqlite3TestMallocFail() ){
@@ -485,11 +486,8 @@ static void OSFREE(void *pFree){
*/
static void * OSREALLOC(void *pRealloc, int n){
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
ThreadData *pTsd = sqlite3ThreadData();
if( !pTsd ){
return 0;
}
sqlite3_nMaxAlloc = MAX(sqlite3_nMaxAlloc, pTsd->nAlloc);
sqlite3_nMaxAlloc =
MAX(sqlite3_nMaxAlloc, sqlite3ThreadDataReadOnly()->nAlloc);
#endif
assert( !sqlite3_mallocDisallowed );
if( !sqlite3TestMallocFail() ){