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

#206 in #define

Download history 42516/week @ 2024-08-27 44937/week @ 2024-09-03 38867/week @ 2024-09-10 38361/week @ 2024-09-17 38949/week @ 2024-09-24 41730/week @ 2024-10-01 15896/week @ 2024-10-08 11348/week @ 2024-10-15 10382/week @ 2024-10-22 9680/week @ 2024-10-29 9463/week @ 2024-11-05 31601/week @ 2024-11-12 33463/week @ 2024-11-19 34697/week @ 2024-11-26 33650/week @ 2024-12-03 30012/week @ 2024-12-10

138,556 downloads per month
Used in 226 crates (8 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

~1.5–9MB
~88K SLoC