Skip to content

Commit

Permalink
Fix MemoryLimit primary_allocated stat (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 authored Sep 18, 2024
1 parent 64c35be commit aede1d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/s3_buffer_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ void s_buffer_pool_trim_synced(struct aws_s3_buffer_pool *buffer_pool) {
aws_array_list_get_at_ptr(&buffer_pool->blocks, (void **)&block, i);

if (block->alloc_bit_mask == 0) {
buffer_pool->primary_allocated -= block->block_size;
aws_mem_release(buffer_pool->base_allocator, block->block_ptr);
aws_array_list_erase(&buffer_pool->blocks, i);
/* do not increment since we just released element */
Expand Down
1 change: 1 addition & 0 deletions tests/s3_buffer_pool_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ static int s_test_s3_buffer_pool_trim(struct aws_allocator *allocator, void *ctx
struct aws_s3_buffer_pool_usage_stats stats_after = aws_s3_buffer_pool_get_usage(buffer_pool);

ASSERT_TRUE(stats_before.primary_num_blocks > stats_after.primary_num_blocks);
ASSERT_TRUE(stats_before.primary_allocated > stats_after.primary_allocated);

for (size_t i = 20; i < 40; ++i) {
aws_s3_buffer_pool_release_ticket(buffer_pool, tickets[i]);
Expand Down

0 comments on commit aede1d8

Please sign in to comment.