all communication between the server and the client, use
`RUST_LOG=gen_lsp_server=debug` (this will print quite a bit of stuff).
-There's `Status of rust-analyzer` command which prints common high-level debug info.
+There's `rust-analyzer: status` command which prints common high-level debug
+info. In particular, it prints info about memory usage of various data
+structures, and, if compiled with jemalloc support (`cargo install --features
+jemalloc`), the summary statistic about the heap.
To run tests, just `cargo test`.
rustc-hash = "1.0"
parking_lot = "0.7.0"
unicase = "2.2.0"
-jemallocator = "0.1.9"
-jemalloc-ctl = "0.2.0"
+
+jemallocator = { version = "0.1.9", optional = true }
+jemalloc-ctl = { version = "0.2.0", optional = true }
ra_syntax = { path = "../ra_syntax" }
ra_ide_api_light = { path = "../ra_ide_api_light" }
[dev-dependencies]
insta = "0.5.1"
+
+[features]
+jemalloc = [ "jemallocator", "jemalloc-ctl" ]
// We use jemalloc mainly to get heap usage statistics, actual performance
// differnece is not measures.
+#[cfg(feature = "jemalloc")]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
}
impl MemoryStats {
+ #[cfg(feature = "jemalloc")]
fn current() -> MemoryStats {
jemalloc_ctl::epoch().unwrap();
MemoryStats {
resident: Bytes(jemalloc_ctl::stats::resident().unwrap()),
}
}
+
+ #[cfg(not(feature = "jemalloc"))]
+ fn current() -> MemoryStats {
+ MemoryStats {
+ allocated: Bytes(0),
+ resident: Bytes(0),
+ }
+ }
}
impl fmt::Display for MemoryStats {
[dev-dependencies]
tempfile = "3"
test_utils = { path = "../test_utils" }
+
+[features]
+jemalloc = [ "ra_ide_api/jemalloc" ]