/ Check-in [e327ef37]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:When calculating schema memory, use the actual allocated size of hash elements, not sizeof(HashElem). Also fix a bug in dbstatus.test.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: e327ef37faec52ce99591266160be2ce2d577cc3
User & Date: dan 2010-07-26 15:57:02
Original Comment: When calculating schema memory, use the actual allocated size of hash elements, not sizeof(HashElem). Also fix a bug in dbstatus.test
Context
2010-07-26
16:24
Add support for SQLITE_DBSTATUS_SCHEMA_USED and SQLITE_DBSTATUS_STMT_USED to the trunk. check-in: 008368b2 user: drh tags: trunk
15:57
When calculating schema memory, use the actual allocated size of hash elements, not sizeof(HashElem). Also fix a bug in dbstatus.test. Closed-Leaf check-in: e327ef37 user: dan tags: experimental
14:47
Add virtual table test cases to dbstatus.test. check-in: 72b84d06 user: dan tags: experimental
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/status.c.

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

      db->pnBytesFreed = &nByte;
      for(i=0; i<db->nDb; i++){
	Schema *pSchema = db->aDb[i].pSchema;
	if( pSchema ){
  	  HashElem *p;

	  nByte += sizeof(HashElem) * (
	      pSchema->tblHash.count 
	    + pSchema->trigHash.count
	    + pSchema->idxHash.count
	    + pSchema->fkeyHash.count
	  );
	  nByte += sqlite3MallocSize(pSchema->tblHash.ht);
	  nByte += sqlite3MallocSize(pSchema->trigHash.ht);







|







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

      db->pnBytesFreed = &nByte;
      for(i=0; i<db->nDb; i++){
        Schema *pSchema = db->aDb[i].pSchema;
        if( pSchema ){
            HashElem *p;

          nByte += sqlite3GlobalConfig.m.xRoundup(sizeof(HashElem)) * (
              pSchema->tblHash.count 
            + pSchema->trigHash.count
            + pSchema->idxHash.count
            + pSchema->fkeyHash.count
          );
          nByte += sqlite3MallocSize(pSchema->tblHash.ht);
          nByte += sqlite3MallocSize(pSchema->trigHash.ht);

Changes to test/dbstatus.test.

287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
    incr nAlloc1 [lookaside db]
    set nStmt1   [lindex [sqlite3_db_status db SQLITE_DBSTATUS_STMT_USED 0] 1]
    execsql $statements
  
    # Step 3.
    db cache flush
    set nAlloc2  [lindex [sqlite3_status SQLITE_STATUS_MEMORY_USED 0] 1]
    incr nAlloc3 [lookaside db]
    set nStmt2   [lindex [sqlite3_db_status db SQLITE_DBSTATUS_STMT_USED 0] 1]
    
    # Step 3.
    execsql $statements
    set nAlloc3  [lindex [sqlite3_status SQLITE_STATUS_MEMORY_USED 0] 1]
    incr nAlloc3 [lookaside db]
    set nStmt3   [lindex [sqlite3_db_status db SQLITE_DBSTATUS_STMT_USED 0] 1]







|







287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
    incr nAlloc1 [lookaside db]
    set nStmt1   [lindex [sqlite3_db_status db SQLITE_DBSTATUS_STMT_USED 0] 1]
    execsql $statements
  
    # Step 3.
    db cache flush
    set nAlloc2  [lindex [sqlite3_status SQLITE_STATUS_MEMORY_USED 0] 1]
    incr nAlloc2 [lookaside db]
    set nStmt2   [lindex [sqlite3_db_status db SQLITE_DBSTATUS_STMT_USED 0] 1]
    
    # Step 3.
    execsql $statements
    set nAlloc3  [lindex [sqlite3_status SQLITE_STATUS_MEMORY_USED 0] 1]
    incr nAlloc3 [lookaside db]
    set nStmt3   [lindex [sqlite3_db_status db SQLITE_DBSTATUS_STMT_USED 0] 1]