]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
WIP
authorOndrej Sury <ondrej@calcifer.home.sury.org>
Thu, 25 Feb 2021 16:52:30 +0000 (17:52 +0100)
committerOndřej Surý <ondrej@sury.org>
Wed, 3 Mar 2021 14:32:01 +0000 (15:32 +0100)
lib/isc/mem.c
lib/isc/tests/mem_test.c

index 3330779bfe95c65aa83c44bd4cf092c37f41d934..5f9e42d2b0234129f65335034707ef1d63b23e00 100644 (file)
@@ -1243,10 +1243,13 @@ isc_mempool_destroy(isc_mempool_t **mpctxp) {
        isc_mem_t *mctx;
        element *item;
 
+       
        mpctx = *mpctxp;
        *mpctxp = NULL;
        mpctx->magic = 0;
 
+       fprintf(stderr, "%s(%p)\n", __func__, mpctx);
+
        if (atomic_load_acquire(&mpctx->allocated) > 0) {
                UNEXPECTED_ERROR(__FILE__, __LINE__,
                                 "isc_mempool_destroy(): mempool %s "
@@ -1322,6 +1325,7 @@ isc__mempool_get(isc_mempool_t *mpctx FLARG) {
        unsigned int i;
 
        REQUIRE(VALID_MEMPOOL(mpctx));
+       REQUIRE(isc_tid_v < mpctx->max_threads);
 
        element *item;
 
@@ -1354,6 +1358,7 @@ isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) {
 
        REQUIRE(VALID_MEMPOOL(mpctx));
        REQUIRE(mem != NULL);
+       REQUIRE(isc_tid_v < mpctx->max_threads);
 
        isc_mem_t *mctx = mpctx->mctx;
        element *item;
@@ -1364,19 +1369,6 @@ isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) {
 
        DELETE_TRACE(mctx, mem, mpctx->size, file, line);
 
-       /*
-        * If the number of freeitems is more than number of allocated items,
-        * return the item to the allocator.
-        */
-       if (freecount >= allocated) {
-               mem_putstats(mctx, mem, mpctx->size);
-               mem_put(mctx, mem, mpctx->size);
-               return;
-       }
-
-       /*
-        * Otherwise, attach it to our free list and bump the counter.
-        */
        item = (element *)mem;
        item->next = mpctx->items[isc_tid_v];
        mpctx->items[isc_tid_v] = item;
index b7434f03edf0bcbabe95eeae5d5715006469f8b3..4a8dea2a5d6c1c67df72ce9dbac425d0c9835c6d 100644 (file)
@@ -355,7 +355,7 @@ isc_mem_traceflag_test(void **state) {
 
 #define ITERS    512
 #define NUM_ITEMS 1024 /* 768 */
-#define ITEM_SIZE 65534
+#define ITEM_SIZE 256
 
 static atomic_size_t mem_size;