Skip to content

Conversation

@stepancheg
Copy link
Contributor

We are implementing memory profiler for Rust.

We can approximate how much memory is occupied by RawTable by replicating some logic of RawTable, but it would be more correct/reliable if RawTable just exposed this information.

RawTable::allocation_info returns just that.

It returns both Layout and pointer to allocated memory.

Pointer is helpful when using with jemalloc: the pointer can be passed to malloc_usable_size function to measure precisely not just how much memory is requested by RawTable, but also what is malloc padding for the allocation.

We are implementing memory profiler for Rust.

We can approximate how much memory is occupied by `RawTable` by
replicating some logic of `RawTable`, but it would be more
correct/reliable if `RawTable` just exposed this information.

`RawTable::allocation_info` returns just that.

It returns both `Layout` and pointer to allocated memory.

Pointer is helpful when using with jemalloc: the pointer can be
passed to `malloc_usable_size` function to measure precisely not
just how much memory is requested by `RawTable`, but also what is
malloc padding for the allocation.
@Amanieu
Copy link
Member

Amanieu commented Nov 9, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Nov 9, 2022

📌 Commit 299b0f6 has been approved by Amanieu

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Nov 9, 2022

⌛ Testing commit 299b0f6 with merge bf272b6...

@bors
Copy link
Contributor

bors commented Nov 9, 2022

☀️ Test successful - checks-actions
Approved by: Amanieu
Pushing bf272b6 to master...

@bors bors merged commit bf272b6 into rust-lang:master Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants