SQLite

Check-in [80db61acca]
Login

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

Overview
Comment:Strenghten an assert() in malloc.c that helps to ensure that allocated memory is freed by the appropriate routine.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 80db61acca034a8edff0fd23a65a0bbc9206a7b3
User & Date: drh 2010-07-23 17:32:23.000
Context
2010-07-23
17:37
Merge two leaves. (check-in: 54e5886d84 user: dan tags: trunk)
17:32
Strenghten an assert() in malloc.c that helps to ensure that allocated memory is freed by the appropriate routine. (check-in: 80db61acca user: drh tags: trunk)
17:06
Remove additional traces (mostly in comments) of the Table.dbMem field. (check-in: 5c58f44aeb user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/malloc.c.
457
458
459
460
461
462
463
464

465
466
467
468
469
470
471
  assert( db==0 || sqlite3_mutex_held(db->mutex) );
  if( isLookaside(db, p) ){
    LookasideSlot *pBuf = (LookasideSlot*)p;
    pBuf->pNext = db->lookaside.pFree;
    db->lookaside.pFree = pBuf;
    db->lookaside.nOut--;
  }else{
    assert( sqlite3MemdebugHasType(p, MEMTYPE_DB|MEMTYPE_HEAP) );

    sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
    sqlite3_free(p);
  }
}

/*
** Change the size of an existing memory allocation







|
>







457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
  assert( db==0 || sqlite3_mutex_held(db->mutex) );
  if( isLookaside(db, p) ){
    LookasideSlot *pBuf = (LookasideSlot*)p;
    pBuf->pNext = db->lookaside.pFree;
    db->lookaside.pFree = pBuf;
    db->lookaside.nOut--;
  }else{
    assert( sqlite3MemdebugHasType(p,
                       db ? (MEMTYPE_DB|MEMTYPE_HEAP) : MEMTYPE_HEAP) );
    sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
    sqlite3_free(p);
  }
}

/*
** Change the size of an existing memory allocation