Skip to content

Commit 9caea14

Browse files
fix test assert for total malloc amounts
1 parent 418b96e commit 9caea14

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test/hotspot/gtest/nmt/test_nmt_chunk_accounting.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ TEST_VM(NMTChunkAccounting, standard_chunks) {
9898
return;
9999
}
100100
static const size_t GROW_SIZE = Chunk::size;
101-
static const size_t NUM_ALLOCS = 64;
101+
static const size_t NUM_ALLOCS = 512;
102102
CountersSnapshot after_grow;
103103
Arena::suspend_chunk_pool_cleaning(true);
104104
{
@@ -119,9 +119,9 @@ TEST_VM(NMTChunkAccounting, standard_chunks) {
119119
// mtTest should grow matching arena size.
120120
EXPECT_EQ(arena.size_in_bytes(), expected_arena_size);
121121
EXPECT_EQ(after_grow.mtTest_arena_size, arena.size_in_bytes());
122-
// Total malloc counters should have grown too.
123-
EXPECT_GE(after_grow.all_mallocs_size, baseline.all_mallocs_size + expected_arena_size / 2);
124-
EXPECT_GE(after_grow.all_mallocs_count, baseline.all_mallocs_count + NUM_ALLOCS / 2);
122+
// Total malloc counters should have grown too, but ensure we account for free chunks pre-existing in the pool.
123+
EXPECT_GE(after_grow.all_mallocs_size, baseline.all_mallocs_size + expected_arena_size / 2 - baseline.mtChunk_malloc_size);
124+
EXPECT_GE(after_grow.all_mallocs_count, baseline.all_mallocs_count + NUM_ALLOCS / 2 - baseline.mtChunk_malloc_count);
125125
}
126126

127127
const CountersSnapshot after_destroy = take_snapshot();

0 commit comments

Comments
 (0)