[introduction]: a more powerful Linux memory analysis tool.
Bytehound is a memory analysis tool for Linux. It can display memory change curve, occupancy details, complete stack records and other information, which is helpful to solve problems such as memory leakage. The detailed functions are as follows:
- It can be used to analyze memory leaks, accurately view memory consumption, identify temporarily allocated memory and detect memory fragments
- Collect the information of each application and memory release operation, and track the complete stack information
- It can dynamically eliminate the temporarily allocated memory and analyze it for a long time
- The use of a custom stack information presentation implementation makes it more efficient than other similar tools and may be several orders of magnitude faster in some cases
- The collected data can be exported to various formats: the data can be exported to JSON, heaptrack (which can be analyzed by using heaptrack GUI) and flame diagram
- Web based GUI for analysis
- Analysis data can be dynamically streamed to another machine instead of being stored locally, which is very useful for analysis on memory constrained systems
- Supports AMD64, arm, aarch64 and MIPS64 architectures (MIPS64 requires a kernel patch perf_event_open)
- Support analysis of applications using jemalloc as allocator (only applicable to jemallocator based on AMD64 Architecture)
- Support rhai based embedded DSL, allowing programming and automatic data analysis
The project address is:
- GCC, rust and yarn are installed to build the GUI
$ cargo build --release -p bytehound-preload $ cargo build --release -p bytehound-cli
- Get binaries from target / release / libbytehound.so or target / release / bytehound
$ export MEMORY_PROFILER_LOG=warn $ LD_PRELOAD=./libbytehound.so ./your_application $ ./bytehound server memory-profiling_*.dat
Then open the browser to accesshttp://localhost:8080。
Open debug log
For performance reasons, the analyzer disables most debug logs at compile time by default. If you want to enable debug logs, you need to use the debug logs function to recompile and build:
$ cd preload $ cargo build --release --features debug-logs
Bytehound analyzer controls its behavior through many environment variables. The following are some commonly used environment variables.
Default: memory profiling #% e_% t_% p. DAT, indicating the path of the file to which the data will be written, supports placeholders, which will be replaced at runtime with the following:% p – > PID of the process% T – > seconds since the UNIX era% e – > name of the executable file% n – > automatic increment counter (0, 1,…, 9, 10, etc.)
The log level to use; Possible values: trace, debug, info, warn, error
The path of the file to which the log will be written; If not set, the log will be sent to stderr and support similar to memory_ PROFILER_ Placeholder for output (except% n).
Default value: 0. When set to 1, temporary assignments are eliminated and omitted from the output. If you only care about memory leaks or want to conduct long-term analysis in a few days, you can set it to 1.
Default value: 0, which determines when to collect time stamps for each event or only for event blocks. When enabled, the timestamp will be more accurate, but will increase CPU utilization.
Open source outpostShare popular, interesting and practical open source projects on a daily basis. Participate in maintaining the open source technology resource library of 100000 + star, including python, Java, C / C + +, go, JS, CSS, node.js, PHP,. Net, etc.