Skip to content

Commit a23f898

Browse files
committed
---
yaml --- r: 115691 b: refs/heads/try c: 32988db h: refs/heads/master i: 115689: dd3f6d3 115687: d0451fb v: v3
1 parent dd04ee5 commit a23f898

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: bee4e6adac17f87b1cdc26ab69f8c0f5d82575a3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ec0258a381b88b5574e3f8ce72ae553ac3a574b7
5-
refs/heads/try: f3de28a920b9a9f2b9418b305dfeb30995d2c6d4
5+
refs/heads/try: 32988db2bd82edc92f54c2d32fdcbd748ab78cd4
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libstd/rt/heap.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
// FIXME: #13996: need a way to mark the `allocate` and `reallocate` return values as `noalias`
1313

1414
use intrinsics::{abort, cttz32};
15-
use libc::{c_int, c_void, size_t};
16-
use ptr::RawPtr;
15+
use libc::{c_char, c_int, c_void, size_t};
16+
use ptr::{RawPtr, mut_null, null};
17+
use option::{None, Option};
1718

1819
#[link(name = "jemalloc", kind = "static")]
1920
extern {
@@ -22,6 +23,9 @@ extern {
2223
fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
2324
fn je_dallocx(ptr: *mut c_void, flags: c_int);
2425
fn je_nallocx(size: size_t, flags: c_int) -> size_t;
26+
fn je_malloc_stats_print(write_cb: Option<extern "C" fn(cbopaque: *mut c_void, *c_char)>,
27+
cbopaque: *mut c_void,
28+
opts: *c_char);
2529
}
2630

2731
// -lpthread needs to occur after -ljemalloc, the earlier argument isn't enough
@@ -99,6 +103,16 @@ pub fn usable_size(size: uint, align: uint) -> uint {
99103
unsafe { je_nallocx(size as size_t, mallocx_align(align)) as uint }
100104
}
101105

106+
/// Print implementation-defined allocator statistics.
107+
///
108+
/// These statistics may be inconsistent if other threads use the allocator during the call.
109+
#[unstable]
110+
pub fn stats_print() {
111+
unsafe {
112+
je_malloc_stats_print(None, mut_null(), null())
113+
}
114+
}
115+
102116
/// The allocator for unique pointers.
103117
#[cfg(stage0)]
104118
#[lang="exchange_malloc"]

0 commit comments

Comments
 (0)