Skip to content

Feature: More accurate memory statistics #608

@mapleFU

Description

@mapleFU

Describe what you are looking for

In memory_mapping_allocator_gt, memory is allocated in last_arena_, the scaling code is listed below:

std::size_t new_cap = (std::max)(last_capacity_, ceil2(extended_bytes)) * capacity_multiplier();

And memory used is not stored in allocator, instead it's calculated:

std::size_t total_allocated() const noexcept {
if (!last_arena_)
return 0;
std::size_t total_used = 0;
std::size_t last_capacity = last_capacity_;
do {
total_used += last_capacity;
last_capacity /= capacity_multiplier();
} while (last_capacity >= min_capacity());
return total_used;

Since memory scaling is not simply * 2

Can you contribute to the implementation?

  • I can contribute

Is your feature request specific to a certain interface?

It applies to everything

Contact Details

maplewish117@gmail.com

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions