summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2021-03-28 00:56:14 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2021-03-28 16:04:01 +0100
commit8cb34ed5d75213c1d779076ab2959da54af98a1e (patch)
tree3dd36c459e2f5e02834e215c56dab4550b9f2a87
parent1e30b0199daf7a7a882458251a3dc10d45d4c7d1 (diff)
Memory handling: fix size backoff on store-reset
-rw-r--r--src/src/store.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/src/store.c b/src/src/store.c
index 9de3f3ff1..22615ea08 100644
--- a/src/src/store.c
+++ b/src/src/store.c
@@ -282,7 +282,9 @@ these functions are mostly called for small amounts of store. */
if (size > yield_length[pool])
{
- int length = MAX(STORE_BLOCK_SIZE(store_block_order[pool]), size);
+ int length = MAX(
+ STORE_BLOCK_SIZE(store_block_order[pool]) - ALIGNED_SIZEOF_STOREBLOCK,
+ size);
int mlength = length + ALIGNED_SIZEOF_STOREBLOCK;
storeblock * newblock;
@@ -545,15 +547,10 @@ if ( yield_length[pool] < STOREPOOL_MIN_SIZE
bb = b->next;
b->next = NULL;
-/* If there will be only one block left in the pool, drop one
-most-recent allocation size increase, ensuring it does not increase
-forever. */
-
-if (!bb && store_block_order[pool] > 12) store_block_order[pool]--;
-
while ((b = bb))
{
int siz = b->length + ALIGNED_SIZEOF_STOREBLOCK;
+
#ifndef COMPILE_UTILITY
if (debug_store)
assert_no_variables(b, b->length + ALIGNED_SIZEOF_STOREBLOCK,
@@ -564,6 +561,10 @@ while ((b = bb))
pool_malloc -= siz;
nblocks[pool]--;
internal_store_free(b, func, linenumber);
+
+#ifndef RESTRICTED_MEMORY
+ if (store_block_order[pool] > 13) store_block_order[pool]--;
+#endif
}
/* Cut out the debugging stuff for utilities, but stop picky compilers from
@@ -739,7 +740,7 @@ for (storeblock * b = chainbase[pool]; b; b = b->next)
memset(bb, 0xF0, bb->length+ALIGNED_SIZEOF_STOREBLOCK);
#endif /* COMPILE_UTILITY */
- free(bb);
+ internal_store_free(bb, func, linenumber);
return;
}
}
@@ -898,7 +899,7 @@ DEBUG(D_memory)
debug_printf("----Exit npools max: %3d kB\n", max_pool_malloc/1024);
for (int i = 0; i < NPOOLS; i++)
debug_printf("----Exit pool %d max: %3d kB in %d blocks at order %u\t%s %s\n",
- i, maxbytes[i]/1024, maxblocks[i], maxorder[i],
+ i, (maxbytes[i]+1023)/1024, maxblocks[i], maxorder[i],
poolclass[i], pooluse[i]);
}
#endif