Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 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. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | experimental-pcache |
Files: | files | file ages | folders |
SHA1: |
6bda711f93e753dd0be8d896a007b3f7 |
User & Date: | drh 2011-11-10 02:39:28.949 |
Context
2011-11-11
| ||
14:12 | Pull over all the latest changes from trunk. (check-in: 1bbbf8574a user: drh tags: experimental-pcache) | |
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) | |
Changes
Changes to src/main.c.
︙ | ︙ | |||
478 479 480 481 482 483 484 | /* Free any existing lookaside buffer for this handle before ** allocating a new one so we don't have to have space for ** both at the same time. */ if( db->lookaside.bMalloced ){ sqlite3_free(db->lookaside.pStart); } | | | > < < | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | /* Free any existing lookaside buffer for this handle before ** allocating a new one so we don't have to have space for ** both at the same time. */ if( db->lookaside.bMalloced ){ sqlite3_free(db->lookaside.pStart); } /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger ** than a pointer to be useful. */ sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */ if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0; if( cnt<0 ) cnt = 0; if( sz==0 || cnt==0 ){ sz = 0; pStart = 0; }else if( pBuf==0 ){ sqlite3BeginBenignMalloc(); pStart = sqlite3Malloc( sz*cnt ); /* IMP: R-61949-35727 */ sqlite3EndBenignMalloc(); if( pStart ) cnt = sqlite3MallocSize(pStart)/sz; }else{ pStart = pBuf; } db->lookaside.pStart = pStart; db->lookaside.pFree = 0; db->lookaside.sz = (u16)sz; if( pStart ){ int i; |
︙ | ︙ |