Open kstrafe opened 4 years ago
Using catch unwind we can panic while letting the unwinder deallocate. Here's one place where we leak 8152 bytes.
pub fn new_x11_any_thread() -> Result<EventLoop<T>, XNotSupported> {
let xconn = match X11_BACKEND.lock().as_ref() {
Ok(xconn) => xconn.clone(),
Err(err) => return Err(err.clone()),
};
Adding a panic before this match seems to not trigger the 8512 region:
Dangling region (0x7f4968010d00-0x7f4968010e80 (size: 384, align: 1))
Panic after match:
Dangling region (0x7fa05800e4a0-0x7fa0580105e0 (size: 8512, align: 8))
Dangling region (0x7fa0580105f0-0x7fa058010770 (size: 384, align: 1))
Edit: this might be a static variable issue. See https://github.com/udoprog/checkers/issues/5
Using checkers to check for dangling memory leads us to the following simple case.
Cargo.toml:
Platform: Linux 5.5.6-1 (Manjaro) running X11 version 11.0, X.Org version: 1.20.6, ran under i3-wm version 4.18 (2020-02-18) Running the above test using cargo test yields: