Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Unexpected result from heap_size_of_children #98

Open
@cswinter

Description

@cswinter

Noob question:

I have an enum with a variant that contains just a Vec<u8>. I derive HeapSizeOf on the enum using the macro from the heapsize_derive crate. Results are the same when I manually implement HeapSizeOf by calling heap_size_of_children on the inner values.

When I query the inner len and capacity of the vector I get 4194575. When I call heap_size_of_children on the enum, I get 5242880. Where could that extra size come from? I'm thinking allocator overhead, is heapsize able to account for that? Memory usage reported by the OS actually agrees with the smaller number, but I suppose the additional pages would not have been touched.

Maybe relevant?

  • I called shrink_to_fit on the vector
  • I'm running under WSL which should be linking jemalloc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions