diff options
-rw-r--r-- | slabs.c | 2 | ||||
-rw-r--r-- | t/slabs-reassign2.t | 12 |
2 files changed, 12 insertions, 2 deletions
@@ -232,7 +232,6 @@ static int do_slabs_newslab(const unsigned int id) { split_slab_page_into_freelist(ptr, id); p->slab_list[p->slabs++] = ptr; - mem_malloced += len; MEMCACHED_SLABS_SLABCLASS_ALLOCATE(id); return 1; @@ -430,6 +429,7 @@ static void *memory_allocate(size_t size) { mem_avail = 0; } } + mem_malloced += size; return ret; } diff --git a/t/slabs-reassign2.t b/t/slabs-reassign2.t index f072d60..c8e6c1e 100644 --- a/t/slabs-reassign2.t +++ b/t/slabs-reassign2.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 9; +use Test::More tests => 11; use FindBin qw($Bin); use lib "$Bin/lib"; use MemcachedTest; @@ -75,6 +75,11 @@ for ($tries = 20; $tries > 0; $tries--) { } cmp_ok($tries, '>', 0, 'reclaimed 61 pages before timeout'); +{ + my $stats = mem_stats($sock, "slabs"); + is($stats->{total_malloced}, 68157440, "total_malloced is what we expect"); +} + # Set into an entirely new class. Overload a bit to try to cause problems. $value = "B"x4096; for (1 .. $keycount * 4) { @@ -86,3 +91,8 @@ for (1 .. $keycount * 4) { is($stats->{curr_items}, 14490, "stored 14490 4k items"); is($stats->{slab_global_page_pool}, 0, "drained the global page pool"); } + +{ + my $stats = mem_stats($sock, "slabs"); + is($stats->{total_malloced}, 68157440, "total_malloced is same after re-assignment"); +} |