Fossil SCM

Be more aggressive about keeping the size of the content cache under control.

drh 2011-05-13 09:57 trunk
Commit cf24da6941cdb5df80a6109097b5f009a2303aee
1 file changed +4 -1
+4 -1
--- src/content.c
+++ src/content.c
@@ -79,11 +79,14 @@
7979
** The cache will deallocate memory when it has finished with it.
8080
*/
8181
void content_cache_insert(int rid, Blob *pBlob){
8282
struct cacheLine *p;
8383
if( contentCache.n>500 || contentCache.szTotal>50000000 ){
84
- content_cache_expire_oldest();
84
+ int cnt = 0;
85
+ do{
86
+ content_cache_expire_oldest();
87
+ }while( cnt++<10 && contentCache.szTotal>50000000 );
8588
}
8689
if( contentCache.n>=contentCache.nAlloc ){
8790
contentCache.nAlloc = contentCache.nAlloc*2 + 10;
8891
contentCache.a = fossil_realloc(contentCache.a,
8992
contentCache.nAlloc*sizeof(contentCache.a[0]));
9093
--- src/content.c
+++ src/content.c
@@ -79,11 +79,14 @@
79 ** The cache will deallocate memory when it has finished with it.
80 */
81 void content_cache_insert(int rid, Blob *pBlob){
82 struct cacheLine *p;
83 if( contentCache.n>500 || contentCache.szTotal>50000000 ){
84 content_cache_expire_oldest();
 
 
 
85 }
86 if( contentCache.n>=contentCache.nAlloc ){
87 contentCache.nAlloc = contentCache.nAlloc*2 + 10;
88 contentCache.a = fossil_realloc(contentCache.a,
89 contentCache.nAlloc*sizeof(contentCache.a[0]));
90
--- src/content.c
+++ src/content.c
@@ -79,11 +79,14 @@
79 ** The cache will deallocate memory when it has finished with it.
80 */
81 void content_cache_insert(int rid, Blob *pBlob){
82 struct cacheLine *p;
83 if( contentCache.n>500 || contentCache.szTotal>50000000 ){
84 int cnt = 0;
85 do{
86 content_cache_expire_oldest();
87 }while( cnt++<10 && contentCache.szTotal>50000000 );
88 }
89 if( contentCache.n>=contentCache.nAlloc ){
90 contentCache.nAlloc = contentCache.nAlloc*2 + 10;
91 contentCache.a = fossil_realloc(contentCache.a,
92 contentCache.nAlloc*sizeof(contentCache.a[0]));
93

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button