Go to the source code of this file.
Classes | |
struct | Mem0Global |
Defines | |
#define | mem0 GLOBAL(struct Mem0Global, mem0) |
Functions | |
static void | softHeapLimitEnforcer (void *NotUsed, sqlite3_int64 inUse, int allocSize) |
void | sqlite3_soft_heap_limit (int n) |
int | sqlite3_release_memory (int n) |
int | sqlite3MallocInit (void) |
void | sqlite3MallocEnd (void) |
sqlite3_int64 | sqlite3_memory_used (void) |
sqlite3_int64 | sqlite3_memory_highwater (int resetFlag) |
int | sqlite3MemoryAlarm (void(*xCallback)(void *pArg, sqlite3_int64 used, int N), void *pArg, sqlite3_int64 iThreshold) |
int | sqlite3_memory_alarm (void(*xCallback)(void *pArg, sqlite3_int64 used, int N), void *pArg, sqlite3_int64 iThreshold) |
static void | sqlite3MallocAlarm (int nByte) |
static int | mallocWithAlarm (int n, void **pp) |
void * | sqlite3Malloc (int n) |
EXPORT_C void * | sqlite3_malloc (int n) |
void * | sqlite3ScratchMalloc (int n) |
void | sqlite3ScratchFree (void *p) |
static int | isLookaside (sqlite3 *db, void *p) |
int | sqlite3MallocSize (void *p) |
int | sqlite3DbMallocSize (sqlite3 *db, void *p) |
EXPORT_C void | sqlite3_free (void *p) |
void | sqlite3DbFree (sqlite3 *db, void *p) |
void * | sqlite3Realloc (void *pOld, int nBytes) |
void * | sqlite3_realloc (void *pOld, int n) |
void * | sqlite3MallocZero (int n) |
void * | sqlite3DbMallocZero (sqlite3 *db, int n) |
void * | sqlite3DbMallocRaw (sqlite3 *db, int n) |
void * | sqlite3DbRealloc (sqlite3 *db, void *p, int n) |
void * | sqlite3DbReallocOrFree (sqlite3 *db, void *p, int n) |
char * | sqlite3DbStrDup (sqlite3 *db, const char *z) |
char * | sqlite3DbStrNDup (sqlite3 *db, const char *z, int n) |
void | sqlite3SetString (char **pz, sqlite3 *db, const char *zFormat,...) |
int | sqlite3ApiExit (sqlite3 *db, int rc) |
Variables | |
static SQLITE_WSD struct Mem0Global | mem0 |
#define mem0 GLOBAL(struct Mem0Global, mem0) |
Definition at line 107 of file malloc.c.
Referenced by mallocWithAlarm(), sqlite3_free(), sqlite3Malloc(), sqlite3MallocAlarm(), sqlite3MallocEnd(), sqlite3MallocInit(), sqlite3MemoryAlarm(), sqlite3Realloc(), sqlite3ScratchFree(), and sqlite3ScratchMalloc().
static int isLookaside | ( | sqlite3 * | db, | |
void * | p | |||
) | [static] |
Definition at line 491 of file malloc.c.
References sqlite3::lookaside, Lookaside::pEnd, and Lookaside::pStart.
Referenced by sqlite3DbFree(), sqlite3DbMallocSize(), and sqlite3DbRealloc().
static int mallocWithAlarm | ( | int | n, | |
void ** | pp | |||
) | [static] |
Definition at line 235 of file malloc.c.
References mem0, sqlite3_mutex_held, sqlite3GlobalConfig, sqlite3MallocAlarm(), sqlite3MallocSize(), sqlite3StatusAdd(), sqlite3StatusSet(), sqlite3StatusValue(), SQLITE_STATUS_MALLOC_SIZE, and SQLITE_STATUS_MEMORY_USED.
Referenced by sqlite3Malloc(), and sqlite3ScratchMalloc().
static void softHeapLimitEnforcer | ( | void * | NotUsed, | |
sqlite3_int64 | inUse, | |||
int | allocSize | |||
) | [static] |
Definition at line 26 of file malloc.c.
References sqlite3_release_memory().
Referenced by sqlite3_soft_heap_limit().
EXPORT_C void sqlite3_free | ( | void * | p | ) |
Definition at line 516 of file malloc.c.
References mem0, sqlite3_mutex_enter, sqlite3_mutex_leave, sqlite3GlobalConfig, sqlite3MallocSize(), sqlite3StatusAdd(), and SQLITE_STATUS_MEMORY_USED.
Referenced by balance_shallower(), bestVirtualIndex(), clearTableSpec(), constructVtab(), dataBufferDestroy(), DbMain(), DbObjCmd(), dlcDelete(), do_meta_command(), dump_callback(), freeStringArray(), fts2HashFree(), fts3HashFree(), fulltext_vtab_destroy(), fulltextClose(), fulltextFilter(), fulltextRename(), fulltextSchema(), groupConcatFinalize(), hashDestroy(), hexFunc(), interiorWriterDestroy(), invalidateOverflowCache(), loadExt(), loadSegmentLeavesInt(), lowerFunc(), memjrnlTruncate(), openDatabase(), optimizeFunc(), pager_delmaster(), pcacheFree(), pcacheResizeHash(), porterClose(), porterDestroy(), process_input(), queryClear(), quoteFunc(), randomBlob(), rehash(), releaseLockInfo(), releaseOpenCnt(), removeElementGivenHash(), replaceFunc(), run_schema_dump_query(), saveCursorPosition(), scalarFunc(), schemaIsValid(), setupLookaside(), simpleClose(), simpleCreate(), simpleDestroy(), snippetClear(), snippetText(), sql_exec(), sql_get_statement(), sql_prepare(), sqlite3_close(), sqlite3_free_table(), sqlite3_get_table(), sqlite3_get_table_cb(), sqlite3_reset_auto_extension(), sqlite3AutoLoadExtensions(), sqlite3BitvecBuiltinTest(), sqlite3BitvecDestroy(), sqlite3BtreeClearCursor(), sqlite3BtreeClose(), sqlite3BtreeIntegrityCheck(), sqlite3BtreeMovetoUnpacked(), sqlite3BtreeOpen(), sqlite3BtreeRestoreCursorPosition(), sqlite3DbFree(), sqlite3Fts2Init(), sqlite3Fts2InitHashTable(), sqlite3Fts3Init(), sqlite3Fts3InitHashTable(), sqlite3HashClear(), sqlite3HashInsert(), sqlite3InitOne(), sqlite3InvalidFunction(), sqlite3LoadExtension(), sqlite3OsCloseFree(), sqlite3OsOpenMalloc(), sqlite3PagerClose(), sqlite3PagerOpen(), sqlite3PcacheClose(), sqlite3Pragma(), sqlite3Realloc(), sqlite3RunParser(), sqlite3VdbeExec(), sqlite3VXPrintf(), tokenizeString(), trimFunc(), unixUnlock(), unlockAllTables(), upperFunc(), writeZeroSegment(), and xFree().
EXPORT_C void* sqlite3_malloc | ( | int | n | ) |
Definition at line 283 of file malloc.c.
References sqlite3_initialize(), and sqlite3Malloc().
Referenced by constructVtab(), content_select(), dataBufferInit(), dlcNew(), fillInUnixFile(), findLockInfo(), fts2HashMalloc(), fts3HashMalloc(), fulltextOpen(), icuCaseFunc16(), interiorBlockNew(), interiorWriterRootInfo(), loadSegmentLeavesInt(), memjrnlWrite(), optimizeFunc(), parseSpec(), porterCreate(), porterOpen(), queryAdd(), simpleCreate(), simpleOpen(), sqlite3_get_table(), sqlite3_get_table_cb(), sqlite3BitvecBuiltinTest(), sqlite3Fts2Init(), sqlite3Fts3Init(), string_dup_n(), string_format(), tokenizeString(), and writeZeroSegment().
int sqlite3_memory_alarm | ( | void(*)(void *pArg, sqlite3_int64 used, int N) | xCallback, | |
void * | pArg, | |||
sqlite3_int64 | iThreshold | |||
) |
Definition at line 204 of file malloc.c.
References sqlite3MemoryAlarm().
sqlite3_int64 sqlite3_memory_highwater | ( | int | resetFlag | ) |
Definition at line 175 of file malloc.c.
References sqlite3_status(), and SQLITE_STATUS_MEMORY_USED.
sqlite3_int64 sqlite3_memory_used | ( | void | ) |
Definition at line 162 of file malloc.c.
References sqlite3_status(), and SQLITE_STATUS_MEMORY_USED.
Referenced by sqlite3_soft_heap_limit().
void* sqlite3_realloc | ( | void * | pOld, | |
int | n | |||
) |
Definition at line 589 of file malloc.c.
References sqlite3_initialize(), and sqlite3Realloc().
Referenced by dataBufferExpand(), porterNext(), queryAdd(), replaceFunc(), simpleNext(), snippetAppendMatch(), sqlite3_auto_extension(), sqlite3_get_table(), sqlite3_get_table_cb(), sqlite3DbRealloc(), sqlite3VtabMakeWritable(), and unixClose().
int sqlite3_release_memory | ( | int | n | ) |
Definition at line 63 of file malloc.c.
References SQLITE_OK.
Referenced by softHeapLimitEnforcer(), and sqlite3_soft_heap_limit().
void sqlite3_soft_heap_limit | ( | int | n | ) |
Definition at line 38 of file malloc.c.
References softHeapLimitEnforcer(), sqlite3_initialize(), sqlite3_memory_used(), sqlite3_release_memory(), and sqlite3MemoryAlarm().
int sqlite3ApiExit | ( | sqlite3 * | db, | |
int | rc | |||
) |
Definition at line 775 of file malloc.c.
References sqlite3::errMask, sqlite3::mallocFailed, sqlite3::mutex, sqlite3_mutex_held, sqlite3Error(), SQLITE_IOERR_NOMEM, and SQLITE_NOMEM.
Referenced by bindText(), blobReadWrite(), columnMallocFailure(), createModule(), openDatabase(), sqlite3_bind_value(), sqlite3_blob_open(), sqlite3_complete16(), sqlite3_create_collation(), sqlite3_create_collation16(), sqlite3_create_collation_v2(), sqlite3_create_function(), sqlite3_create_function16(), sqlite3_declare_vtab(), sqlite3_exec(), sqlite3_open16(), sqlite3_overload_function(), sqlite3_step(), sqlite3Prepare(), sqlite3Prepare16(), and sqlite3Step().
void sqlite3DbFree | ( | sqlite3 * | db, | |
void * | p | |||
) |
Definition at line 532 of file malloc.c.
References isLookaside(), sqlite3::lookaside, Lookaside::nOut, Lookaside::pFree, LookasideSlot::pNext, and sqlite3_free().
Referenced by addModuleArgument(), attachFunc(), bestVirtualIndex(), callCollNeeded(), callFinaliser(), Cleanup(), codeAttach(), createModule(), findCollSeqEntry(), flattenSubquery(), freeEphemeralFunction(), freeIndex(), freeP4(), lookupName(), multiSelect(), releaseMemArray(), replaceFunc(), resolveAlias(), resolveAsName(), resolveP2Values(), selectColumnsFromExprList(), selectExpander(), sqlite3_blob_close(), sqlite3_blob_open(), sqlite3_close(), sqlite3_create_collation16(), sqlite3_create_function16(), sqlite3_declare_vtab(), sqlite3_exec(), sqlite3_step(), sqlite3AddCollateType(), sqlite3AddColumn(), sqlite3AddColumnType(), sqlite3AlterFinishAddColumn(), sqlite3AlterRenameTable(), sqlite3AnalysisLoad(), sqlite3Analyze(), sqlite3BeginTrigger(), sqlite3CloseExtensions(), sqlite3CreateForeignKey(), sqlite3CreateIndex(), sqlite3DbRealloc(), sqlite3DbReallocOrFree(), sqlite3DeleteTable(), sqlite3DeleteTrigger(), sqlite3DeleteTriggerStep(), sqlite3EndTable(), sqlite3ErrorClear(), sqlite3ErrorMsg(), sqlite3ExprClear(), sqlite3ExprDelete(), sqlite3ExprListDelete(), sqlite3ExprListDup(), sqlite3ExprSetColl(), sqlite3FindDb(), sqlite3FinishTrigger(), sqlite3IdListDelete(), sqlite3IdListDup(), sqlite3IndexKeyinfo(), sqlite3InitCallback(), sqlite3InitOne(), sqlite3Insert(), sqlite3LoadExtension(), sqlite3MAppendf(), sqlite3NestedParse(), sqlite3Pragma(), sqlite3Prepare(), sqlite3Prepare16(), sqlite3Reindex(), sqlite3ResetInternalSchema(), sqlite3RunParser(), sqlite3Select(), sqlite3SelectDelete(), sqlite3SelectNew(), sqlite3SetString(), sqlite3SrcListDelete(), sqlite3StartTable(), sqlite3StrAccumReset(), sqlite3TokenCopy(), sqlite3Update(), sqlite3ValueFree(), sqlite3ValueFromExpr(), sqlite3VdbeDelete(), sqlite3VdbeDeleteUnpackedRecord(), sqlite3VdbeExec(), sqlite3VdbeFifoClear(), sqlite3VdbeFifoPop(), sqlite3VdbeFreeCursor(), sqlite3VdbeHalt(), sqlite3VdbeMemFinalize(), sqlite3VdbeMemGrow(), sqlite3VdbeMemRelease(), sqlite3VdbeReset(), sqlite3VdbeSetNumCols(), sqlite3VtabCallConnect(), sqlite3VtabClear(), sqlite3VtabFinishParse(), sqlite3VtabOverloadFunction(), sqlite3VtabSync(), sqlite3WhereEnd(), sqliteResetColumnNames(), vdbeCommit(), vtabCallConstructor(), whereClauseClear(), whereClauseInsert(), whereInfoFree(), and whereTempTriggers().
void* sqlite3DbMallocRaw | ( | sqlite3 * | db, | |
int | n | |||
) |
Definition at line 638 of file malloc.c.
References Lookaside::bEnabled, sqlite3::lookaside, sqlite3::mallocFailed, Lookaside::mxOut, Lookaside::nOut, Lookaside::pFree, LookasideSlot::pNext, and sqlite3Malloc().
Referenced by allocateFifoPage(), attachFunc(), createModule(), dup8bytes(), multiSelectOrderBy(), sqlite3DbMallocZero(), sqlite3DbRealloc(), sqlite3DbStrDup(), sqlite3DbStrNDup(), sqlite3ExprDup(), sqlite3ExprListDup(), sqlite3HexToBlob(), sqlite3IdListDup(), sqlite3Insert(), sqlite3SelectDup(), sqlite3SrcListDup(), sqlite3StrAccumAppend(), sqlite3StrAccumFinish(), sqlite3Update(), sqlite3VdbeExec(), sqlite3VdbeMemGrow(), sqlite3VdbeMemTranslate(), sqlite3VdbeRecordUnpack(), strftimeFunc(), and whereClauseInsert().
int sqlite3DbMallocSize | ( | sqlite3 * | db, | |
void * | p | |||
) |
Definition at line 505 of file malloc.c.
References isLookaside(), sqlite3::lookaside, sqlite3GlobalConfig, and Lookaside::sz.
Referenced by sqlite3VdbeMemGrow().
void* sqlite3DbMallocZero | ( | sqlite3 * | db, | |
int | n | |||
) |
Definition at line 612 of file malloc.c.
References sqlite3DbMallocRaw().
Referenced by bestVirtualIndex(), codeAlias(), findCollSeqEntry(), keyInfoFromExprList(), multiSelect(), multiSelectOrderBy(), selectColumnsFromExprList(), selectExpander(), sqlite3_blob_open(), sqlite3_exec(), sqlite3AlterBeginAddColumn(), sqlite3BeginTrigger(), sqlite3CreateForeignKey(), sqlite3CreateIndex(), sqlite3Expr(), sqlite3ExprFunction(), sqlite3ExprListAppend(), sqlite3FindFunction(), sqlite3IdListAppend(), sqlite3IndexKeyinfo(), sqlite3LoadExtension(), sqlite3ResultSetOfSelect(), sqlite3SelectNew(), sqlite3SrcListAppend(), sqlite3StartTable(), sqlite3TriggerDeleteStep(), sqlite3TriggerInsertStep(), sqlite3TriggerSelectStep(), sqlite3TriggerUpdateStep(), sqlite3ValueNew(), sqlite3VdbeCreate(), sqlite3VdbeMakeReady(), sqlite3VdbeSetNumCols(), sqlite3VtabOverloadFunction(), sqlite3WhereBegin(), and yy_reduce().
void* sqlite3DbRealloc | ( | sqlite3 * | db, | |
void * | p, | |||
int | n | |||
) |
Definition at line 672 of file malloc.c.
References isLookaside(), sqlite3::lookaside, sqlite3::mallocFailed, sqlite3_realloc(), sqlite3DbFree(), sqlite3DbMallocRaw(), and Lookaside::sz.
Referenced by addModuleArgument(), addToVTrans(), attachFunc(), resizeOpArray(), sqlite3_set_auxdata(), sqlite3AddColumn(), sqlite3ArrayAllocate(), sqlite3DbReallocOrFree(), sqlite3ExprListAppend(), and sqlite3SrcListEnlarge().
void* sqlite3DbReallocOrFree | ( | sqlite3 * | db, | |
void * | p, | |||
int | n | |||
) |
Definition at line 701 of file malloc.c.
References sqlite3DbFree(), and sqlite3DbRealloc().
Referenced by codeEqualityTerm(), sqlite3ExprAssignVarNumber(), sqlite3TableLock(), sqlite3VdbeExec(), sqlite3VdbeMakeLabel(), and sqlite3VdbeMemGrow().
char* sqlite3DbStrDup | ( | sqlite3 * | db, | |
const char * | z | |||
) |
Definition at line 717 of file malloc.c.
References sqlite3DbMallocRaw().
Referenced by attachFunc(), selectAddColumnTypeAndCollation(), selectColumnsFromExprList(), sqlite3_step(), sqlite3AlterBeginAddColumn(), sqlite3BeginTrigger(), sqlite3BtreeIntegrityCheck(), sqlite3ExprListDup(), sqlite3FixSrcList(), sqlite3IdListDup(), sqlite3LoadExtension(), sqlite3Pragma(), sqlite3SrcListDup(), sqlite3Utf16to8(), sqlite3VdbeExec(), sqlite3VtabBeginParse(), and sqlite3VtabOverloadFunction().
char* sqlite3DbStrNDup | ( | sqlite3 * | db, | |
const char * | z, | |||
int | n | |||
) |
Definition at line 731 of file malloc.c.
References sqlite3DbMallocRaw().
Referenced by addArgumentToVtab(), callCollNeeded(), flattenSubquery(), generateColumnNames(), sqlite3AlterFinishAddColumn(), sqlite3ExprDup(), sqlite3FinishTrigger(), sqlite3NameFromToken(), sqlite3Prepare(), sqlite3TokenCopy(), sqlite3ValueFromExpr(), sqlite3VdbeChangeP4(), sqlite3VdbeSetSql(), and sqlitePersistTriggerStep().
void* sqlite3Malloc | ( | int | n | ) |
Definition at line 264 of file malloc.c.
References mallocWithAlarm(), mem0, sqlite3_mutex_enter, sqlite3_mutex_leave, and sqlite3GlobalConfig.
Referenced by balance_shallower(), contextMalloc(), createTableStmt(), pager_delmaster(), pcacheMalloc(), pcacheResizeHash(), saveCursorPosition(), schemaIsValid(), setupLookaside(), sqlite3_exec(), sqlite3_malloc(), sqlite3BtreeIntegrityCheck(), sqlite3BtreeMovetoUnpacked(), sqlite3BtreeOpen(), sqlite3DbMallocRaw(), sqlite3HashInsert(), sqlite3IndexAffinityStr(), sqlite3MallocZero(), sqlite3OsOpenMalloc(), sqlite3PagerOpen(), sqlite3Realloc(), sqlite3RunParser(), sqlite3TableAffinityStr(), sqlite3VdbeChangeP4(), sqlite3VdbeExec(), and sqlite3VXPrintf().
static void sqlite3MallocAlarm | ( | int | nByte | ) | [static] |
Definition at line 216 of file malloc.c.
References mem0, sqlite3_mutex_enter, sqlite3_mutex_leave, sqlite3StatusValue(), and SQLITE_STATUS_MEMORY_USED.
Referenced by mallocWithAlarm(), and sqlite3Realloc().
void sqlite3MallocEnd | ( | void | ) |
Definition at line 154 of file malloc.c.
References mem0, and sqlite3GlobalConfig.
Referenced by sqlite3_shutdown().
int sqlite3MallocInit | ( | void | ) |
Definition at line 112 of file malloc.c.
References mem0, sqlite3GlobalConfig, sqlite3MemSetDefault(), sqlite3MutexAlloc, and SQLITE_MUTEX_STATIC_MEM.
Referenced by sqlite3_initialize().
int sqlite3MallocSize | ( | void * | p | ) |
Definition at line 502 of file malloc.c.
References sqlite3GlobalConfig.
Referenced by mallocWithAlarm(), pcacheFree(), pcacheMalloc(), sqlite3_free(), sqlite3Realloc(), and sqlite3ScratchFree().
void* sqlite3MallocZero | ( | int | n | ) |
Definition at line 600 of file malloc.c.
References sqlite3Malloc().
Referenced by accessPayload(), lockTable(), openDatabase(), rehash(), sqlite3BitvecCreate(), sqlite3BtreeOpen(), sqlite3BtreeSchema(), sqlite3InitOne(), sqlite3PagerOpen(), and sqlite3SchemaGet().
int sqlite3MemoryAlarm | ( | void(*)(void *pArg, sqlite3_int64 used, int N) | xCallback, | |
void * | pArg, | |||
sqlite3_int64 | iThreshold | |||
) |
Definition at line 186 of file malloc.c.
References mem0, sqlite3_mutex_enter, sqlite3_mutex_leave, and SQLITE_OK.
Referenced by sqlite3_memory_alarm(), and sqlite3_soft_heap_limit().
void* sqlite3Realloc | ( | void * | pOld, | |
int | nBytes | |||
) |
Definition at line 546 of file malloc.c.
References mem0, sqlite3_free(), sqlite3_mutex_enter, sqlite3_mutex_leave, sqlite3GlobalConfig, sqlite3Malloc(), sqlite3MallocAlarm(), sqlite3MallocSize(), sqlite3StatusAdd(), sqlite3StatusSet(), sqlite3StatusValue(), SQLITE_STATUS_MALLOC_SIZE, and SQLITE_STATUS_MEMORY_USED.
Referenced by sqlite3_realloc().
void sqlite3ScratchFree | ( | void * | p | ) |
Definition at line 359 of file malloc.c.
References mem0, sqlite3_mutex_enter, sqlite3_mutex_leave, sqlite3GlobalConfig, sqlite3MallocSize(), sqlite3StatusAdd(), SQLITE_STATUS_MEMORY_USED, SQLITE_STATUS_SCRATCH_OVERFLOW, and SQLITE_STATUS_SCRATCH_USED.
Referenced by balance_nonroot().
void* sqlite3ScratchMalloc | ( | int | n | ) |
Definition at line 309 of file malloc.c.
References mallocWithAlarm(), mem0, sqlite3_mutex_enter, sqlite3_mutex_leave, sqlite3GlobalConfig, sqlite3StatusAdd(), sqlite3StatusSet(), SQLITE_STATUS_SCRATCH_OVERFLOW, SQLITE_STATUS_SCRATCH_SIZE, and SQLITE_STATUS_SCRATCH_USED.
Referenced by balance_nonroot().
void sqlite3SetString | ( | char ** | pz, | |
sqlite3 * | db, | |||
const char * | zFormat, | |||
... | ||||
) |
Definition at line 750 of file malloc.c.
References sqlite3DbFree(), and sqlite3VMPrintf().
Referenced by corruptSchema(), sqlite3InitOne(), sqlite3RunParser(), sqlite3RunVacuum(), sqlite3VdbeExec(), and sqlite3VdbeList().
SQLITE_WSD struct Mem0Global mem0 [static] |
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:00 2011 by Doxygen 1.6.1