From b93de48354d91bdbbe1f8b02c6cec2e76e625630 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Wed, 22 Oct 1997 23:07:24 +0000 Subject: [PATCH] Track 'store_mem_size' by the number of 4k pages allocated from stmem.c --- src/stmem.cc | 6 +++++- src/store.cc | 6 +----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/stmem.cc b/src/stmem.cc index 48e5affc73..7c2f92b241 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -1,6 +1,6 @@ /* - * $Id: stmem.cc,v 1.49 1997/10/17 00:00:02 wessels Exp $ + * $Id: stmem.cc,v 1.50 1997/10/22 17:07:25 wessels Exp $ * * DEBUG: section 19 Memory Primitives * AUTHOR: Harvest Derived @@ -128,12 +128,14 @@ memFree(mem_hdr * mem) p = p->next; if (lastp) { put_free_4k_page(lastp->data); + store_mem_size -= SM_PAGE_SIZE; safe_free(lastp); } } if (p) { put_free_4k_page(p->data); + store_mem_size -= SM_PAGE_SIZE; safe_free(p); } } @@ -158,6 +160,7 @@ memFreeDataUpto(mem_hdr * mem, int target_offset) p = p->next; current_offset += lastp->len; put_free_4k_page(lastp->data); + store_mem_size -= SM_PAGE_SIZE; safe_free(lastp); } } @@ -197,6 +200,7 @@ memAppend(mem_hdr * mem, const char *data, int len) p->next = NULL; p->len = len_to_copy; p->data = get_free_4k_page(); + store_mem_size += SM_PAGE_SIZE; xmemcpy(p->data, data, len_to_copy); if (!mem->head) { /* The chain is empty */ diff --git a/src/store.cc b/src/store.cc index 96bd986f34..c6c495e353 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.299 1997/10/21 16:13:51 wessels Exp $ + * $Id: store.cc,v 1.300 1997/10/22 17:07:24 wessels Exp $ * * DEBUG: section 20 Storeage Manager * AUTHOR: Harvest Derived @@ -120,8 +120,6 @@ #define STORE_LOG_SWAPOUT 2 #define STORE_LOG_RELEASE 3 -#define ENTRY_INMEM_SIZE(X) ((X)->inmem_hi - (X)->inmem_lo) - static char *storeLogTags[] = { "CREATE", @@ -388,7 +386,6 @@ destroy_MemObjectData(MemObject * mem) { debug(20, 3) ("destroy_MemObjectData: destroying %p, %d bytes\n", mem->data, mem->inmem_hi); - store_mem_size -= ENTRY_INMEM_SIZE(mem); if (mem->data) { memFree(mem->data); mem->data = NULL; @@ -1033,7 +1030,6 @@ storeAppend(StoreEntry * e, const char *buf, int len) if (len) { debug(20, 5) ("storeAppend: appending %d bytes for '%s'\n", len, e->key); storeGetMemSpace(len); - store_mem_size += len; memAppend(mem->data, buf, len); mem->inmem_hi += len; } -- 2.47.3