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

Experimental code to measure memory consumed by database schemas and prepared statements.

FossilOrigin-Name: 9aa30342f4de4eff630520ea8e07ad253d3f0877
This commit is contained in:
dan
2010-07-24 11:28:28 +00:00
parent 5419ee5f2f
commit d46def77db
14 changed files with 430 additions and 97 deletions

View File

@@ -490,18 +490,17 @@ static int analysisLoader(void *pData, int argc, char **argv, char **NotUsed){
** If the Index.aSample variable is not NULL, delete the aSample[] array
** and its contents.
*/
void sqlite3DeleteIndexSamples(Index *pIdx){
void sqlite3DeleteIndexSamples(sqlite3 *db, Index *pIdx){
#ifdef SQLITE_ENABLE_STAT2
if( pIdx->aSample ){
int j;
for(j=0; j<SQLITE_INDEX_SAMPLES; j++){
IndexSample *p = &pIdx->aSample[j];
if( p->eType==SQLITE_TEXT || p->eType==SQLITE_BLOB ){
sqlite3_free(p->u.z);
sqlite3DbFree(db, p->u.z);
}
}
sqlite3DbFree(0, pIdx->aSample);
pIdx->aSample = 0;
sqlite3DbFree(db, pIdx->aSample);
}
#else
UNUSED_PARAMETER(pIdx);
@@ -542,7 +541,8 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
Index *pIdx = sqliteHashData(i);
sqlite3DefaultRowEst(pIdx);
sqlite3DeleteIndexSamples(pIdx);
sqlite3DeleteIndexSamples(db, pIdx);
pIdx->aSample = 0;
}
/* Check to make sure the sqlite_stat1 table exists */