Skip to content

Commit 5f423a1

Browse files
committed
Auto merge of #2231 - devnexen:darwin_malloc_stats, r=Amanieu
apple add few malloc debug features specifics
2 parents dac89a3 + 669bbfb commit 5f423a1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/unix/bsd/apple/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,22 @@ s! {
629629
pub struct thread_throughput_qos_policy {
630630
pub thread_throughput_qos_tier: thread_throughput_qos_t,
631631
}
632+
633+
// malloc/malloc.h
634+
pub struct malloc_statistics_t {
635+
pub blocks_in_use: ::c_uint,
636+
pub size_in_use: ::size_t,
637+
pub max_size_in_use: ::size_t,
638+
pub size_allocated: ::size_t,
639+
}
640+
641+
pub struct mstats {
642+
pub bytes_total: ::size_t,
643+
pub chunks_used: ::size_t,
644+
pub bytes_used: ::size_t,
645+
pub chunks_free: ::size_t,
646+
pub bytes_free: ::size_t,
647+
}
632648
}
633649

634650
s_no_extra_traits! {
@@ -4055,6 +4071,8 @@ extern "C" {
40554071
pub fn memset_pattern8(b: *mut ::c_void, pattern8: *const ::c_void, len: ::size_t);
40564072
pub fn memset_pattern16(b: *mut ::c_void, pattern16: *const ::c_void, len: ::size_t);
40574073

4074+
pub fn mstats() -> mstats;
4075+
40584076
pub fn proc_listpids(
40594077
t: u32,
40604078
typeinfo: u32,

0 commit comments

Comments
 (0)