SQLite

Check-in [0e53ecad94]
Login

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

Overview
Comment:Use sqlite3MallocSize() to get the actual size of the memory allocation used for lookaside cache and increase the size of the cache to use the full allocation.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | experimental-pcache
Files: files | file ages | folders
SHA1: 0e53ecad9468d0a13d155a4462551d4c234a7d5c
User & Date: drh 2011-11-10 02:24:11.076
Context
2011-11-10
02:39
Follow-on to the previous check-in to prevent a division by zero if the lookahead slot size is something goofy like 6 on a 32-bit machine. (check-in: 6bda711f93 user: drh tags: experimental-pcache)
02:24
Use sqlite3MallocSize() to get the actual size of the memory allocation used for lookaside cache and increase the size of the cache to use the full allocation. (check-in: 0e53ecad94 user: drh tags: experimental-pcache)
2011-11-09
17:01
When compiling with MSVC, use the _msize function. (check-in: 797a147934 user: mistachkin tags: experimental-pcache)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
491
492
493
494
495
496
497

498
499
500
501
502
503
504
    sz = 0;
    pStart = 0;
  }else if( pBuf==0 ){
    sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */
    sqlite3BeginBenignMalloc();
    pStart = sqlite3Malloc( sz*cnt );  /* IMP: R-61949-35727 */
    sqlite3EndBenignMalloc();

  }else{
    sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */
    pStart = pBuf;
  }
  db->lookaside.pStart = pStart;
  db->lookaside.pFree = 0;
  db->lookaside.sz = (u16)sz;







>







491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
    sz = 0;
    pStart = 0;
  }else if( pBuf==0 ){
    sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */
    sqlite3BeginBenignMalloc();
    pStart = sqlite3Malloc( sz*cnt );  /* IMP: R-61949-35727 */
    sqlite3EndBenignMalloc();
    if( pStart ) cnt = sqlite3MallocSize(pStart)/sz;
  }else{
    sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */
    pStart = pBuf;
  }
  db->lookaside.pStart = pStart;
  db->lookaside.pFree = 0;
  db->lookaside.sz = (u16)sz;