1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Arrange for ThreadData to be automatically deallocated even if SQLITE_MEMDEBUG is defined. Fix for #1623. (CVS 2965)

FossilOrigin-Name: 9e2e40845d30cc150abe23ee318a721b4fe9613c
This commit is contained in:
danielk1977
2006-01-17 16:10:13 +00:00
parent 08659fee65
commit cbb8496c5e
7 changed files with 41 additions and 21 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.471 2006/01/17 15:36:32 danielk1977 Exp $
** @(#) $Id: sqliteInt.h,v 1.472 2006/01/17 16:10:14 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -310,15 +310,31 @@ struct ThreadData {
#endif
#ifdef SQLITE_MEMDEBUG
void *pFirst; /* Pointer to linked list of allocations */
int nMaxAlloc; /* High water mark of ThreadData.nAlloc */
int mallocDisallowed; /* assert() in sqlite3Malloc() if set */
int isFail; /* True if all malloc() calls should fail */
const char *zFile; /* Filename to associate debugging info with */
int iLine; /* Line number to associate debugging info with */
void *pFirst; /* Pointer to linked list of allocations */
#endif
};
/*
** The THREADDATASIZE macro is used by the system that automatically
** deallocates ThreadData structures. If the first THREADDATASIZE bytes
** of a ThreadData structure are all zero, then the structure is eligible
** for deallocation.
**
** Usually, THREADDATASIZE is set to the size of the structure. However
** if SQLITE_MEMDEBUG is defined, all variables declared after the
** ThreadData.pFirst variable are excluded.
*/
#ifdef SQLITE_MEMDEBUG
#define THREADDATASIZE (int)(&(((ThreadData *)0)->nMaxAlloc))
#else
#define THREADDATASIZE sizeof(ThreadData)
#endif
/*
** Name of the master database table. The master database table
** is a special table that holds the names and attributes of all