Skip to content

Commit 4561a0a

Browse files
committed
---
yaml --- r: 151548 b: refs/heads/try2 c: 32988db h: refs/heads/master v: v3
1 parent 2e6c99f commit 4561a0a

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: f3de28a920b9a9f2b9418b305dfeb30995d2c6d4
8+
refs/heads/try2: 32988db2bd82edc92f54c2d32fdcbd748ab78cd4
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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)