20 releases (11 breaking)

0.12.0 Sep 20, 2022
0.11.0 Feb 4, 2022
0.10.2 Sep 20, 2021
0.10.0 Jul 2, 2021
0.2.0 Jul 4, 2019

#4 in #sizeof

Download history 13227/week @ 2025-10-20 12704/week @ 2025-10-27 15355/week @ 2025-11-03 12038/week @ 2025-11-10 18666/week @ 2025-11-17 11598/week @ 2025-11-24 11426/week @ 2025-12-01 12032/week @ 2025-12-08 9972/week @ 2025-12-15 10829/week @ 2025-12-22 9822/week @ 2025-12-29 8272/week @ 2026-01-05 7846/week @ 2026-01-12 11406/week @ 2026-01-19 9680/week @ 2026-01-26 11683/week @ 2026-02-02

41,240 downloads per month
Used in 219 crates (7 directly)

MIT/Apache

70KB
1.5K SLoC

parity-util-mem

Collection of memory related utilities.

WARNING

When parity-util-mem is used as a dependency with any of the global allocator features enabled, it must be the sole place where a global allocator is defined. The only exception to this rule is when used in a no_std context or when the estimate-heapsize feature is used.

Because of that, it must be present in the dependency tree with a single version. Starting from version 0.6.1, having duplicate versions of parity-util-mem will lead to a compile-time error. It still will be possible to have 0.5 and 0.6.1 versions in the same binary though.

Unless heeded you risk UB; see discussion in issue 364.

Features

  • estimate-heapsize : Do not use allocator, but size_of or size_of_val.

Others features define global allocator, see src/alloc.rs.

Dependency

This crate groups common dependency, a patched copy of unpublished malloc_size_of from servo project is copied and partially reexported.

Malloc_size_of code is used internally as a module with a few modification to be able to implement type locally.

For existing code using deprecated HeapsizeOf crate, calls to heapsize_of_children should be replace by calls to size_of.

Dependencies

~2.8–6MB
~114K SLoC