1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Automatically deallocate thread-specific data when it is no longer

being used.  Ticket #1601.  Also implemented the suggestion of
ticket #1603. Memory management is now off by default at compile-time.
The sqlite3_enable_memory_management() API has been removed. (CVS 2919)

FossilOrigin-Name: 5d9c6aa964305c3f36741ff0058da5b5f3ce0d24
This commit is contained in:
drh
2006-01-11 21:41:20 +00:00
parent 0203bde908
commit 6f7adc8a80
31 changed files with 334 additions and 299 deletions

View File

@@ -81,14 +81,16 @@ void sqlite3BeginTrigger(
** If sqlite3SrcListLookup() returns 0, indicating the table does not
** exist, the error is caught by the block below.
*/
if( !pTableName || sqlite3ThreadData()->mallocFailed ) goto trigger_cleanup;
if( !pTableName || sqlite3ThreadDataReadOnly()->mallocFailed ){
goto trigger_cleanup;
}
pTab = sqlite3SrcListLookup(pParse, pTableName);
if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
iDb = 1;
}
/* Ensure the table name matches database name and that the table exists */
if( sqlite3ThreadData()->mallocFailed ) goto trigger_cleanup;
if( sqlite3ThreadDataReadOnly()->mallocFailed ) goto trigger_cleanup;
assert( pTableName->nSrc==1 );
if( sqlite3FixInit(&sFix, pParse, iDb, "trigger", pName) &&
sqlite3FixSrcList(&sFix, pTableName) ){
@@ -255,7 +257,7 @@ void sqlite3FinishTrigger(
pDel = sqlite3HashInsert(&db->aDb[iDb].pSchema->trigHash,
pTrig->name, strlen(pTrig->name)+1, pTrig);
if( pDel ){
assert( sqlite3ThreadData()->mallocFailed && pDel==pTrig );
assert( sqlite3ThreadDataReadOnly()->mallocFailed && pDel==pTrig );
goto triggerfinish_cleanup;
}
n = strlen(pTrig->table) + 1;
@@ -439,7 +441,7 @@ void sqlite3DropTrigger(Parse *pParse, SrcList *pName){
int nName;
sqlite3 *db = pParse->db;
if( sqlite3ThreadData()->mallocFailed ) goto drop_trigger_cleanup;
if( sqlite3ThreadDataReadOnly()->mallocFailed ) goto drop_trigger_cleanup;
if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
goto drop_trigger_cleanup;
}