Fossil SCM
Be more aggressive about keeping the size of the content cache under control.
Commit
cf24da6941cdb5df80a6109097b5f009a2303aee
Parent
d8221b98636b76c…
1 file changed
+4
-1
+4
-1
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -79,11 +79,14 @@ | ||
| 79 | 79 | ** The cache will deallocate memory when it has finished with it. |
| 80 | 80 | */ |
| 81 | 81 | void content_cache_insert(int rid, Blob *pBlob){ |
| 82 | 82 | struct cacheLine *p; |
| 83 | 83 | 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 ); | |
| 85 | 88 | } |
| 86 | 89 | if( contentCache.n>=contentCache.nAlloc ){ |
| 87 | 90 | contentCache.nAlloc = contentCache.nAlloc*2 + 10; |
| 88 | 91 | contentCache.a = fossil_realloc(contentCache.a, |
| 89 | 92 | contentCache.nAlloc*sizeof(contentCache.a[0])); |
| 90 | 93 |
| --- 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 |