• Stars
    star
    4,424
  • Rank 9,566 (Top 0.2 %)
  • Language
    C
  • License
    Other
  • Created over 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A memory profiler for Linux.

Bytehound - a memory profiler for Linux

Features

  • Can be used to analyze memory leaks, see where exactly the memory is being consumed, identify temporary allocations and investigate excessive memory fragmentation
  • Gathers every allocation and deallocation, along with full stack traces
  • Can dynamically cull temporary allocations allowing you to profile over a long period of time
  • Uses a custom, tailor-made stack unwinding implementation which makes it a lot cheaper than other similar tools, potentially up to orders of magnitude faster in some cases
  • Can export the data it gathered into various different formats; it can export the data as JSON (so you can analyze it yourself if you want), as Heaptrack (so you can use the excellent Heaptrack GUI for analysis) and as a flamegraph
  • Has its own Web-based GUI which can be used for analysis
  • Can dynamically stream the profiling data to another machine instead of saving it locally, which is useful for profiling on memory-constrained systems
  • Supports AMD64, ARM, AArch64 and MIPS64 architectures (where MIPS64 requires a tiny out-of-tree kernel patch for perf_event_open)
  • Supports profiling of applications which use jemalloc as their allocator (only works on AMD64 with the jemallocator crate)
  • Supports an embedded DSL based on Rhai to allow for programmatic and/or automated data analysis

Screenshots

Building

  1. Install GCC, Rust nightly (only 1.62 or newer is supported) and the Yarn package manager (for building the GUI)

  2. Build it:

     $ cargo build --release -p bytehound-preload
     $ cargo build --release -p bytehound-cli
    
  3. Grab the binaries from target/release/libbytehound.so and target/release/bytehound

Usage

Basic usage

$ export MEMORY_PROFILER_LOG=warn
$ LD_PRELOAD=./libbytehound.so ./your_application
$ ./bytehound server memory-profiling_*.dat

Then open your Web browser and point it at http://localhost:8080 to access the GUI.

Documentation

You can find the full documentation for the profiler in our Memory profiling for fun and profit book.

Enabling full debug logs

By default the profiler is compiled with most of its debug logs disabled for performance reasons. To reenable them be sure to recompile it with the debug-logs feature, e.g. like this:

$ cd preload
$ cargo build --release --features debug-logs

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

More Repositories

1

stdweb

A standard library for the client-side Web
Rust
3,438
star
2

cargo-web

A Cargo subcommand for the client-side Web
Rust
1,099
star
3

not-perf

A sampling CPU profiler for Linux
Rust
868
star
4

pinky

An NES emulator written in Rust
Rust
766
star
5

speedy

A fast binary serialization framework
Rust
337
star
6

polkavm

A fast and secure RISC-V based virtual machine
Rust
194
star
7

schnellru

A fast and flexible LRU map.
Rust
169
star
8

parcel-plugin-cargo-web

JavaScript
48
star
9

libretro-backend

Libretro API bindings for Rust
Rust
46
star
10

sarek

A work-in-progress, experimental neural network library for Rust
Rust
44
star
11

polkadot-starship

Ruby
24
star
12

polkavm-experiment

An experimental RISC-V recompiler
Rust
18
star
13

hooky

A convenient LD_PRELOAD hooker
Rust
11
star
14

rustc-rv32e

Rust toolchain for RV32E
Shell
10
star
15

libretro-sys

Raw FFI bindings to the libretro API
Rust
6
star
16

rwkv_tokenizer

Python
6
star
17

polkadoom

Yet another DOOM port
C++
6
star
18

static_test

Attribute macro for writing tests which check that a given condition ALWAYS holds true or that a given code path is ALWAYS unreachable
Rust
6
star
19

serde-bench

A simple benchmark of various Rust serialization frameworks
Rust
6
star
20

nsctrld

Nintendo Switch Pro Controller userspace driver
Rust
4
star
21

linux-input

Rust
4
star
22

memory-pool

A global, thread-safe memory pool.
Rust
4
star
23

dspr

A DSP plugin server
C++
3
star
24

unsafe_target_feature

A more convenient `#[target_feature]` replacement
Rust
3
star
25

softfloat

Rust
2
star
26

cargo-shim

A helper library for Cargo subcommands
Rust
2
star
27

mmalloc

A simple mmap-based allocator
Rust
2
star
28

chrf

Rust
2
star
29

chromium-build

Shell
1
star
30

koute.github.io

JavaScript
1
star
31

inputd

Rust
1
star
32

linux-elf-loading-bug

Rust
1
star