SQLite

Check-in [5d902b7fea]
Login

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

Overview
Comment:Fix the sqlite3_release_memory() interface so that it works even if SQLITE_DEFAULT_PCACHE_INITSZ is non-zero.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5d902b7fea3144bf57f02aca87b9795fdcec4774310ade6ef01f37d206c3d74f
User & Date: drh 2017-03-29 15:18:40.905
Context
2017-03-29
16:55
Fix some tests in malloc5.test to account for the sqlite3_release_memory() change in the previous commit. (check-in: d336858dfc user: dan tags: trunk)
15:18
Fix the sqlite3_release_memory() interface so that it works even if SQLITE_DEFAULT_PCACHE_INITSZ is non-zero. (check-in: 5d902b7fea user: drh tags: trunk)
2017-03-25
19:16
Add the new sqlite3_set_last_insert_rowid() interface to the extension loader thunk. (check-in: 8469fc0d48 user: drh tags: trunk)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to src/pcache1.c.
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
** been released, the function returns. The return value is the total number 
** of bytes of memory released.
*/
int sqlite3PcacheReleaseMemory(int nReq){
  int nFree = 0;
  assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );
  assert( sqlite3_mutex_notheld(pcache1.mutex) );
  if( sqlite3GlobalConfig.nPage==0 ){
    PgHdr1 *p;
    pcache1EnterMutex(&pcache1.grp);
    while( (nReq<0 || nFree<nReq)
       &&  (p=pcache1.grp.lru.pLruPrev)!=0
       &&  p->isAnchor==0
    ){
      nFree += pcache1MemSize(p->page.pBuf);







|







1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
** been released, the function returns. The return value is the total number 
** of bytes of memory released.
*/
int sqlite3PcacheReleaseMemory(int nReq){
  int nFree = 0;
  assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );
  assert( sqlite3_mutex_notheld(pcache1.mutex) );
  if( sqlite3GlobalConfig.pPage==0 ){
    PgHdr1 *p;
    pcache1EnterMutex(&pcache1.grp);
    while( (nReq<0 || nFree<nReq)
       &&  (p=pcache1.grp.lru.pLruPrev)!=0
       &&  p->isAnchor==0
    ){
      nFree += pcache1MemSize(p->page.pBuf);