diff options
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 1 | ||||
-rw-r--r-- | crates/ra_ide_api/src/status.rs | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index dc531e068..51947e4cc 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -61,6 +61,7 @@ pub use ra_db::{ | |||
61 | 61 | ||
62 | // We use jemalloc mainly to get heap usage statistics, actual performance | 62 | // We use jemalloc mainly to get heap usage statistics, actual performance |
63 | // differnece is not measures. | 63 | // differnece is not measures. |
64 | #[cfg(feature = "jemalloc")] | ||
64 | #[global_allocator] | 65 | #[global_allocator] |
65 | static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; | 66 | static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; |
66 | 67 | ||
diff --git a/crates/ra_ide_api/src/status.rs b/crates/ra_ide_api/src/status.rs index c3e5745d5..bd355dd78 100644 --- a/crates/ra_ide_api/src/status.rs +++ b/crates/ra_ide_api/src/status.rs | |||
@@ -133,6 +133,7 @@ struct MemoryStats { | |||
133 | } | 133 | } |
134 | 134 | ||
135 | impl MemoryStats { | 135 | impl MemoryStats { |
136 | #[cfg(feature = "jemalloc")] | ||
136 | fn current() -> MemoryStats { | 137 | fn current() -> MemoryStats { |
137 | jemalloc_ctl::epoch().unwrap(); | 138 | jemalloc_ctl::epoch().unwrap(); |
138 | MemoryStats { | 139 | MemoryStats { |
@@ -140,6 +141,14 @@ impl MemoryStats { | |||
140 | resident: Bytes(jemalloc_ctl::stats::resident().unwrap()), | 141 | resident: Bytes(jemalloc_ctl::stats::resident().unwrap()), |
141 | } | 142 | } |
142 | } | 143 | } |
144 | |||
145 | #[cfg(not(feature = "jemalloc"))] | ||
146 | fn current() -> MemoryStats { | ||
147 | MemoryStats { | ||
148 | allocated: Bytes(0), | ||
149 | resident: Bytes(0), | ||
150 | } | ||
151 | } | ||
143 | } | 152 | } |
144 | 153 | ||
145 | impl fmt::Display for MemoryStats { | 154 | impl fmt::Display for MemoryStats { |