/ Check-in [5d902b7f]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5d902b7fea3144bf57f02aca87b9795fdcec4774310ade6ef01f37d206c3d74f
User & Date: drh 2017-03-29 15:18:40
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: d336858d 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: 5d902b7f 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: 8469fc0d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pcache1.c.

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