Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upLots of unclassified heap memory #11559
Comments
Something's clearly gone wrong there. Each tree's sub-trees are supposed to add up, and 17592186044408.38 MiB is clearly bogus. I wanted to do DMD for Servo but never got around to it. The hard part was wrapping the heap allocator. I talked with @acrichton about the required machinery for this, which is theoretically in place, but I never tried it out in earnest. DMD also requires that you can get backtraces (to store) on each allocation, and that wasn't in place when I was looking at it, though it might be now. |
|
We have the ability to grab backtraces while running Rust code: Backtrace::new. |
|
Oh, the other complication for DMD with Servo is that you have two malloc heaps -- the system heap, used by all the C/C++ libraries that Servo uses, and the jemalloc heap used by Rust. I never worked out how to deal with that. This problem doesn't occur in Firefox because all heap allocations in Firefox get routed through jemalloc. |
Lovely! Looks like a nice design. |
|
Given https://github.com/rust-lang/rfcs/blob/master/text/1183-swap-out-jemalloc.md and rust-lang/rust#27389, it looks like we might be getting close to being able to create a DMD tool for Servo. |
|
I have Servo building with a custom jemalloc-based allocator with some small changes. In particular, we need to use permanent forks of the libc and memchr crates that disable their attempts to re-export the std crate. This fork of japaric's extraction of rustc's jemalloc allocator allows modifying the allocator functions to add custom behaviour (I added a |
|
Next step is to figure out the parts of http://dxr.mozilla.org/mozilla-central/source/memory/replace/dmd/DMD.cpp that need to be ported. |
|
rust-lang/rfcs#916 describes in detail my previous attempt at DMD for Servo. RFC 1183 may have changed things significantly -- I haven't looked closely at it -- but that issue would still be a good starting point for anyone wanting to work on this. |
|
For anyone reading this and being confused, DMD stands for "dark matter detector". |
|
https://developer.mozilla.org/en-US/docs/Mozilla/Performance/DMD are the docs for DMD. |
|
@nnethercote How is this going? |
|
I am not working on this. |
For example:
@froydnj @nnethercote do you know if we could get DMD set up for Servo?