Bytehound - a memory profiler for Linux

Overview

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 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.

Comments
  • 'memalign' is unimplemented! panic

    'memalign' is unimplemented! panic

    The following problem occurred today, it didn't exist before:

    thread '' panicked at 'not implemented: 'memalign' is unimplemented!', preload/src/api.rs:831:5

    opened by harlanc 10
  • SIGSEGV when loading app with libmemory_profiler.so

    SIGSEGV when loading app with libmemory_profiler.so

    When attempting to load my application with libmemory_profiler.so in LD_PRELOAD, it immediately segfaults.

    Built with:

    rustc 1.36.0-nightly (6afcb5628 2019-05-19)
    

    Captured from GDB:

    gdb --args env LD_PRELOAD=/usr/local/lib/libmemory_profiler.so ./build/myapp
    
    Program received signal SIGSEGV, Segmentation fault.
    0x00007ffff7881e75 in memory_profiler::initialize () at preload/src/lib.rs:1239
    1239	fn initialize() {
    (gdb) bt
    #0  0x00007ffff7881e75 in memory_profiler::initialize () at preload/src/lib.rs:1239
    #1  0x00007ffff7883cc9 in memory_profiler::allocate (size=32, is_calloc=<optimized out>) at preload/src/lib.rs:1417
    #2  malloc (size=32) at preload/src/lib.rs:1459
    #3  0x00007ffff7883df6 in memory_profiler::allocate (size=32, is_calloc=<optimized out>) at preload/src/lib.rs:1429
    #4  malloc (size=32) at preload/src/lib.rs:1459
    ...
    
    opened by NuSkooler 10
  • thread 'main' panicked at 'called `Option::unwrap()` on a `None` value'

    thread 'main' panicked at 'called `Option::unwrap()` on a `None` value'

    Hi

    We have troubles when analysing gathered data. Gathered data is about 9GB. We tried to squeeze the data but it failed. Then we tried to load big data and it failed as well

    ./bytehound strip --output X Y.dat
    thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /tmp/koute/memory-profiler/cli-core/src/squeeze.rs:217:100
    none: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Aborted
    

    when loading big data:

    ./bytehound server Y.dat
    [2022-12-01T15:11:46Z INFO  server_core] Trying to load "Y.dat"...
    thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', cli-core/src/loader.rs:864:68
    stack backtrace:
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    Aborted
    

    Did you encounter such problem? Do you know how we should proceed with that?

    opened by krzysiek6d 7
  • A kingdom for a flamegraph of live allocations!

    A kingdom for a flamegraph of live allocations!

    I am profiling an application which uses obscene amounts of memory, but is not, strictly speaking, leaking memory: if I kill the app, everything is cleanly deallocated.

    Still, I'd love to know what takes all the memory. I think what I need is to take a look at the live allocations at some specific point in time, and get a famegraph. This'll give me essentially a profile for a heap snapshot at a point in time.

    Can I already get this with bytehound? I've seen flamegraph for leaked memory, and the graph of the total live allocations, but neither is quite what I am looking for.

    opened by matklad 6
  • thread '<unnamed>' panicked at 'cannot access a TLS value during or after it is destroyed: AccessError'

    thread '' panicked at 'cannot access a TLS value during or after it is destroyed: AccessError'

    On debian10 with nigthly rust

    thread '<unnamed>' panicked at 'cannot access a TLS value during or after it is destroyed: AccessError', src/libcore/result.rs:999:5
    stack backtrace:
       0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
                 at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
       1: std::panicking::default_hook::{{closure}}
                 at src/libstd/sys_common/backtrace.rs:71
                 at src/libstd/sys_common/backtrace.rs:59
                 at src/libstd/panicking.rs:197
       2: std::panicking::rust_panic_with_hook
                 at src/libstd/panicking.rs:211
                 at src/libstd/panicking.rs:474
       3: std::panicking::continue_panic_fmt
                 at src/libstd/panicking.rs:381
       4: rust_begin_unwind
                 at src/libstd/panicking.rs:308
       5: core::panicking::panic_fmt
                 at src/libcore/panicking.rs:85
       6: core::result::unwrap_failed
                 at /rustc/37ff5d388f8c004ca248adb635f1cc84d347eda0/src/libcore/macros.rs:18
       7: memory_profiler::unwind::grab
                 at /root/.cargo/git/checkouts/not-perf-e01bfa01482c86ed/9739e8b/nwind/src/local_unwinding.rs:0
                 at preload/src/unwind.rs:166
       8: calloc
                 at preload/src/lib.rs:1423
                 at preload/src/lib.rs:1470
       9: g_malloc0
      10: g_slice_free_chain_with_offset
      11: g_queue_free
      12: __nptl_deallocate_tsd.part.8
      13: start_thread
      14: clone
    Aborted (core dumped)
    
    opened by rmanus 6
  • Failed to profile rust application

    Failed to profile rust application

    Failed to profile rust application due to error

    thread '<unnamed>' panicked at 'not implemented: 'aligned_alloc' is unimplemented!', preload/src/api.rs:907:5
    stack backtrace:
       0:     0x7f9661783cea - std::backtrace_rs::backtrace::libunwind::trace::h972caad916e73545
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
       1:     0x7f9661783cea - std::backtrace_rs::backtrace::trace_unsynchronized::he59049878fe5a05d
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
       2:     0x7f9661783cea - std::sys_common::backtrace::_print_fmt::he4a91f9bcfad9b40
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/std/src/sys_common/backtrace.rs:66:5
       3:     0x7f9661783cea - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h51433dc001920472
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/std/src/sys_common/backtrace.rs:45:22
       4:     0x7f966172d10c - core::fmt::write::hc9dbd37d69b2c204
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/core/src/fmt/mod.rs:1198:17
       5:     0x7f9661762b14 - std::io::Write::write_fmt::h6b2550ce8adb9e04
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/std/src/io/mod.rs:1672:15
       6:     0x7f9661784af5 - std::sys_common::backtrace::_print::h006829bd22a5a4ee
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/std/src/sys_common/backtrace.rs:48:5
       7:     0x7f9661784af5 - std::sys_common::backtrace::print::h0f4d319136ab4456
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/std/src/sys_common/backtrace.rs:35:9
       8:     0x7f9661784af5 - std::panicking::default_hook::{{closure}}::h5b3cdff51fbe7401
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/std/src/panicking.rs:295:22
       9:     0x7f9661785075 - std::panicking::default_hook::hdc1d8baf28b4ffd7
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/std/src/panicking.rs:314:9
      10:     0x7f9661785075 - std::panicking::rust_panic_with_hook::h80e138cc00203db9
                                   at /rustc/d68e7ebc38cb42b8b237392b28045edeec761503/library/std/src/panicking.rs:698:17
      11:     0x7f96617f9221 - nwind_ret_trampoline_start
                                   at /home/user/.cargo/git/checkouts/not-perf-af1a46759dd83df9/18bd8d3/nwind/src/arch/amd64_trampoline.s:17
      12:                0x0 - <unknown>
    

    used command

    LD_PRELOAD=./libbytehound.so <rust_application> <args>
    

    Tried with local build from the latest master, and with pre-built versions Target OS: Ubuntu 20.04

    Please let me know if any option is missing to run tool properly, or rust applications are not support for now. Thanks in advance.

    opened by aregng 5
  • Build memory-profiler-cli failed

    Build memory-profiler-cli failed

    1. My environment is Ubuntu 18.04
    2. Yarn has been installed already
    3. Rust has been changed to nightly version
    4. I run "cargo build --release -p memory-profiler" suceessfully and libmemory_profiler.so has been generate already

    When I run "cargo build --release -p memory-profiler-cli", it failed and the error log as below:

    davidwang@system-MS-7918:~/Tools/memory-profiler$ cargo build --release -p memory-profiler-cli Compiling server-core v0.1.0 (/home/davidwang/Tools/memory-profiler/server-core) 00h00m00s 0/0: : **error: failed to run custom build command for server-core v0.1.0** (/home/davidwang/Tools/memory-profiler/server-core)

    Caused by: process didn't exit successfully: /home/davidwang/Tools/memory-profiler/target/release/build/server-core-5dfb1577abf53aa3/build-script-build (exit code: 101) --- stderr ERROR: [Errno 2] No such file or directory: 'install' thread 'main' panicked at 'Failed to install the dependencies for the WebUI; child process exited with error code Some(1)! You might want to try to run 'rm -Rf ~/.cache/yarn' and try again.', server-core/build.rs:61:21 stack backtrace: 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39 1: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:71 2: std::panicking::default_hook::{{closure}} at src/libstd/sys_common/backtrace.rs:59 at src/libstd/panicking.rs:197 3: std::panicking::default_hook at src/libstd/panicking.rs:211 4: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:474 5: std::panicking::continue_panic_fmt at src/libstd/panicking.rs:381 6: std::panicking::begin_panic_fmt at src/libstd/panicking.rs:336 7: semalock::Semalock::with at server-core/build.rs:61 at /home/davidwang/.cargo/registry/src/github.com-1ecc6299db9ec823/semalock-0.2.0/src/lib.rs:99 at /rustc/8869ee03d7f258e1b76a11c6fbb01b5708a9f504/src/libcore/result.rs:639 at /home/davidwang/.cargo/registry/src/github.com-1ecc6299db9ec823/semalock-0.2.0/src/lib.rs:96 8: build_script_build::main at server-core/build.rs:46 9: std::rt::lang_start::{{closure}} at /rustc/8869ee03d7f258e1b76a11c6fbb01b5708a9f504/src/libstd/rt.rs:64 10: std::panicking::try::do_call at src/libstd/rt.rs:49 at src/libstd/panicking.rs:293 11: __rust_maybe_catch_panic at src/libpanic_unwind/lib.rs:85 12: std::rt::lang_start_internal at src/libstd/panicking.rs:272 at src/libstd/panic.rs:388 at src/libstd/rt.rs:48 13: main 14: __libc_start_main 15: _start

    It seems to find install dir failed, but where should the dir be?

    opened by aguludunu 5
  • Idea: Generate memory flamegraph with inferno

    Idea: Generate memory flamegraph with inferno

    Hello, maybe the most things for this are already in place and it's easy to do. Currently manual usage of the heaptrack GUI is needed to see the memory flamegraph. Inferno could be used to directly generate an interactive SVG by exporting a perf-compatible text format (the text format can even be without collapsed stacks, as there is the inferno-collapse-perf command for that).

    opened by pothos 4
  • thread_local_const_init is being stabilized

    thread_local_const_init is being stabilized

    Hi,

    Currently (on 1.59-nightly), bytehound doesn't compile because of the stabilization of thread_local_const_init feature:

    error[E0635]: unknown feature `thread_local_const_init`
     --> preload/src/lib.rs:1:12
      |
    1 | #![feature(thread_local_const_init)]
      |            ^^^^^^^^^^^^^^^^^^^^^^^
    
    For more information about this error, try `rustc --explain E0635`.
    error: could not compile `bytehound-preload` due to previous error
    

    The feature line should be removed from the code from now on I think.

    Cheers, Gerry

    opened by gagbo 3
  • Plotting memory usage of allocations from given backtrace

    Plotting memory usage of allocations from given backtrace

    Adds plots to allocations so that it's possible to tell if given backtrace is the reason for potentially visible memory leak in overview page. Improves greatly feedback regarding if backtrace is a leak or not, as one sees the trend of allocations from this backtrace - are they increasing? or maybe it was just one spike at the end of trace?

    The plot will be visible when "Group by backtraces" is selected.

    PR code is a little wonky though... but it seems to work well.

    opened by stoperro 3
  • Profiling memory usage of Go application

    Profiling memory usage of Go application

    I was thinking about using this project to compare the memory usage of a Go application that I have rewritten in Rust, but when testing the memory-profiler with a simple go example it generated no result.

    Heres the go example I've tested:

    package main
    
    import "fmt"
    import "os"
    import "strconv"
    
    func fib(n uint64) uint64 {
    	switch n {
    	case 0:
    		return 0
    	case 1:
    		return 1
    	default:
    		return fib(n-1) + fib(n-2)
    	}
    }
    
    func main() {
    	input, _ := strconv.Atoi(os.Args[1])
    	n := uint64(input)
    	fmt.Println(fib(n))
    }
    

    And running:

    go build test.go
    LD_PRELOAD=/home/jonathas/Repositories/memory-profiler/target/release/libmemory_profiler.so ./test 40
    

    Didn't generate any dat file at all. I have even tried adding a make or new calls to the fib func in order to introduce more allocations but I still got no results.

    opened by Jonathas-Conceicao 3
  • Bug with not-perf(local_unwinding)

    Bug with not-perf(local_unwinding)

    thread '<unnamed>' panicked at 'index out of bounds: the len is 256 but the index is 18446744073709551615', /home/user/.cargo/git/checkouts/not-perf-af1a46759dd83df9/911723c/nwind/src/local_unwinding.rs:455:26
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Aborted
    

    I got the error(unfortunately I can't attach the code), there is some problem with index calculations.

    I can only say that we are using memory mapping of a huge file (150 GB), while I do not access this memory, everything is ok, I believe that the problems begin immediately when accessing(but that's just a hypothesis).

    Linux version 5.15.0-1026-aws gcc (Ubuntu ~20.04.1) 9.4.0, x86_64

    
    stack backtrace:
       0: rust_begin_unwind
                 at /rustc/d0dc9efff14ac0a1eeceffd1e605e37eeb8362a0/library/std/src/panicking.rs:575:5
       1: core::panicking::panic_fmt
                 at /rustc/d0dc9efff14ac0a1eeceffd1e605e37eeb8362a0/library/core/src/panicking.rs:64:14
       2: core::panicking::panic_bounds_check
                 at /rustc/d0dc9efff14ac0a1eeceffd1e605e37eeb8362a0/library/core/src/panicking.rs:147:5
       3: nwind::local_unwinding::ShadowStack::push
                 at /home/user/.cargo/git/checkouts/not-perf-af1a46759dd83df9/911723c/nwind/src/local_unwinding.rs:455:26
       4: nwind::local_unwinding::LocalAddressSpace::unwind_through_fresh_frames
                 at /home/user/.cargo/git/checkouts/not-perf-af1a46759dd83df9/911723c/nwind/src/local_unwinding.rs:905:27
       5: bytehound::unwind::grab_with_unwind_state
                 at /home/user/bytehound/preload/src/unwind.rs:393:31
       6: nwind_ret_trampoline_start
                 at /home/user/cargo/git/checkouts/not-perf-af1a46759dd83df9/911723c/nwind/src/arch/amd64_trampoline.s:17
    

    I seeamd64_trampoline here, is it ok(I use x86)?

    opened by nuttert 2
  • Max output file size

    Max output file size

    I did not find the maximum size for the output file in the environment variables, I would like to split it into files, for example, 5GB each and send them to remote storage. Maybe this is possible and I missed something?

    opened by nuttert 0
  • query about meaning of terminologies like 'global' and 'matched'.

    query about meaning of terminologies like 'global' and 'matched'.

    Hi! in the backtraces, i see graphs with plots in green and red color. where green is area is said to be 'global' and red is said to be 'matched'. image

    1. What exactly global and matched means?
    2. Also what should i interpret from the following graph for a backtrace: image

    some details about the scenario: About the above graph, the first part where we can see memory consumption increasing continuously is the duration where we were running lock and unlock of a component in our system for some 200 iterations. The later part, which is flat(and in red), is the duration when iterations had completed but profiling continued for some time.

    opened by shapradh 0
  • fix: panic for unknown backtraces

    fix: panic for unknown backtraces

    I had a debugging usecase where the executable would either never finish or get OOM-killed. So I guess the output could be somewhat incomplete/messed up. The output was very large (34GB) so I stripped it (bytehound strip --threshold 10 ...). That bytehound server would crash because it didn't find some backtraces. This PR fixes that and instead just prints a warning.

    opened by crepererum 0
  • LD_PRELOAD undefined symbol: memfd_create

    LD_PRELOAD undefined symbol: memfd_create

    Hi, great project! I successfully compiled the project, but when executing this statement:

    LD_PRELOAD=./libbytehound.so ./bytehound serverv
    

    i got: ./bytehound: symbol lookup error: ./libbytehound.so: undefined symbol: memfd_create

    and every program is like this Did I do something wrong?

    Information about env: In docker container (uname -r = 5.10.104-linuxkit) already install gcc g++

    opened by kp-tux 4
  • [Suggestion] Make the case study scripts an interactive page

    [Suggestion] Make the case study scripts an interactive page

    Dearest Maintainer,

    Bytehound has been a joy to use. Thank you for this. I found the "Case study: Memory leak analysis" after searching for how to use bytehound. I have found the example scripting to be amazingly helpful. My ask would to to make that flow in to a page.

    "by backtrace" which gives the chart and then you can select the groups one at a time.

    A page for leaked until the end as well. maybe that is a filter on by backtrace.

    Last question I have is what does "memory lost to fragmentation" really mean? what does one do with this information?

    Either way! thanks for reading this. I looked at the ui folder and saw it was react. I am very lost in that world but one day might take the time.

    Thanks for the amazing software. It has been very helpful.

    Becker

    opened by sbeckeriv 0
Releases(0.11.0)
  • 0.11.0(Nov 23, 2022)

  • 0.10.0(Nov 17, 2022)

    Major changes:

    • Performance improvements; CPU overhead of allocation-heavy heavily multithreaded programs was cut down by up to ~80%
    • You can now control whether child processes are profiled with the MEMORY_PROFILER_TRACK_CHILD_PROCESSES environment variable (disabled by default)
    • The fragmentation timeline was removed from the UI
    • mmap/munmap calls are now gathered by default (you can disable this with MEMORY_PROFILER_GATHER_MAPS)
    • Total actual memory usage is now gathered by periodically polling /proc/self/smaps
    • Maps can now be browsed in the UI and analyzed through the scripting API
    • Maps are now named according to their source using PR_SET_VMA_ANON_NAME (Linux 5.17 or newer; on older kernels this is emulated in user space)
    • Glibc-internal __mmap and __munmap are now hooked into
    • Bytehound-internal allocations now exclusively use mimalloc as their allocator
    • New scripting APIs:
      • AllocationList::only_alive_at
      • AllocationList::only_from_maps
      • Graph::start_at
      • Graph::end_at
      • Graph::show_address_space
      • Graph::show_rss
      • MapList
      • Map
    • Removed scripting APIs:
      • AllocationList::only_not_deallocated_after_at_least
      • AllocationList::only_not_deallocated_until_at_most
      • Graph::truncate_until
      • Graph::extend_until
    • Removed lifetime filters in the UI: only_not_deallocated_in_current_range, only_deallocated_in_current_range
    • Fixed a rare crash when profiling programs using jemalloc
    • Added support for aligned_alloc
    • Added support for memalign
    • Relative scale in the generated graphs is now always relative to the start of profiling
    • Gathered backtraces will now include an extra Bytehound-specific frame on the bottom to indicate which function was called
    • Minor improvements to the UI
    Source code(tar.gz)
    Source code(zip)
    bytehound-x86_64-unknown-linux-gnu.tgz(41.70 MB)
  • 0.9.0(Jul 25, 2022)

    Major changes:

    • Deallocation backtraces are now gathered by default; you can use the MEMORY_PROFILER_GRAB_BACKTRACES_ON_FREE environment variable to turn this off
    • Deallocation backtraces are now shown in the GUI for each allocation
    • Allocations can now be filtered according to where exactly they were deallocated
    • Allocations can now be filtered according to whether the last allocation in their realloc chain was leaked or not
    • Profiling of executables larger than 4GB is now supported
    • Profiling of executables using unprefixed jemalloc is now supported
    • New scripting APIs:
      • AllocationList::only_matching_deallocation_backtraces
      • AllocationList::only_not_matching_deallocation_backtraces
      • AllocationList::only_position_in_chain_at_least
      • AllocationList::only_position_in_chain_at_most
      • AllocationList::only_chain_leaked
    • The server subcommand of the CLI should now use less memory when loading large data files
    • The behavior of malloc_usable_size when called with a NULL argument now matches glibc
    • At minimum Rust 1.62 is now required to build the crates; older versions might still work, but will not be supported
    • The way the profiler is initialized was reworked; this should increase compatibility and might fix some of the crashes seen when trying to profile certain programs
    Source code(tar.gz)
    Source code(zip)
    bytehound-x86_64-unknown-linux-gnu.tgz(40.25 MB)
  • 0.8.0(Nov 16, 2021)

    Major changes:

    • Significantly lower CPU usage when temporary allocation culling is turned on
    • Each thread has now its own first-level backtrace cache; this might result in higher memory usage when profiling
    • The MEMORY_PROFILER_BACKTRACE_CACHE_SIZE environment variable knob was replaced with MEMORY_PROFILER_BACKTRACE_CACHE_SIZE_LEVEL_1 and MEMORY_PROFILER_BACKTRACE_CACHE_SIZE_LEVEL_2 to control the size of the per-thread caches and the global cache respectively
    • The MEMORY_PROFILER_PRECISE_TIMESTAMPS environment variable knob was removed (always gathering precise timestamps is fast enough on amd64)
    • The default value of MEMORY_PROFILER_TEMPORARY_ALLOCATION_PENDING_THRESHOLD is now unset, which means that the allocations will be buffered indefinitely until they're either culled or until they'll live long enough to not be eligible for culling (might increase memory usage in certain cases)
    • Backtraces are now not emitted for allocations which were completely culled
    • You can now see whether a given allocation was made through jemalloc, and filter according to that
    • You can now see when a given allocation group reached its maximum memory usage was, and filter according to that
    • New scripting APIs:
      • Graph::show_memory_usage
      • Graph::show_live_allocations
      • Graph::show_new_allocations
      • Graph::show_deallocations
      • AllocationList::only_group_max_total_usage_first_seen_at_least
      • AllocationList::only_jemalloc
    • New subcommand: extract (will unpack all of the files embedded into a given data file)
    • The strip subcommand will now not buffer allocations indefinitely when using the --threshold option, which results in a significantly lower memory usage when stripping huge data files from long profiling runs
    • malloc_usable_size now works properly when compiled with the jemalloc feature
    • reallocarray doesn't segfault anymore
    • The compilation should now work on distributions with an ancient version of Yarn
    Source code(tar.gz)
    Source code(zip)
    bytehound-x86_64-unknown-linux-gnu.tgz(36.15 MB)
  • 0.7.0(Aug 18, 2021)

    Major changes:

    • The project was rebranded from memory-profiler to bytehound
    • Profiling of applications using jemalloc is now fully supported (AMD64-only, jemallocator crate only)
    • Added built-in scripting capabilities which can be used for automated analysis and report generation; those can be accessed through the script subcommand
    • Added a scripting console to the GUI
    • Added the ability to define programmatic filters in the GUI
    • Allocation graphs are now shown in the GUI when browsing through the allocations grouped by backtraces
    • Improved support for tracking and analyzing reallocations
    • Improved paralellization of the analyzer's internals, which should result in snappier behavior on modern multicore machines
    • The cutoff point for determining allocations' lifetime is now the end of profiling for those allocations which were never deallocated
    • The squeeze subcommand was renamed to strip
    • You can now use the strip subcommand to strip away only a subset of temporary allocations
    • Information about allocations culled at runtime is now emitted on a per-backtrace basis during profiling
    • Fixed an issue where the shadow stack based unwinding was incompatible with Rust's ABI in certain rare cases
    • mmap calls are now always gathered in order (if you have enabled their gathering)
    • Improved runtime backtrace deduplication which should result in smaller datafiles
    • Many other miscellaneous bugfixes
    Source code(tar.gz)
    Source code(zip)
    bytehound-x86_64-unknown-linux-gnu.tgz(34.30 MB)
  • 0.6.1(Jun 10, 2021)

  • 0.6.0(Jun 9, 2021)

    Major changes:

    • Added a runtime backtrace cache; backtraces are now deduplicated when profiling, which results in less data being generated.
    • Added automatic culling of temporary allocations when running with MEMORY_PROFILER_CULL_TEMPORARY_ALLOCATIONS set to 1.
    • Added support for reallocarray.
    • Added support for unwinding through JITed code, provided the JIT compiler registers its unwinding tables through __register_frame.
    • Added support for unwinding through frames which require arbitrary DWARF expressions to be evaluated when resolving register values.
    • Added support for DWARF expressions that fetch memory.
    • Allocations are not tracked by their addresses anymore; they're now tracked by unique IDs, which fixes a race condition when multiple threads are simultaneously allocating and deallocating memory in quick succession.
    • mmap calls are now not gathered by default.
    • Rewrote TLS state management; some deallocations from TLS destructors which were previously missed by the profiler are now gathered.
    • When profiling is disabled at runtime the profiler doesn't completely shutdown anymore, and will keep on gathering data for those allocations which were made before it was disabled; when reenabled it won't create a new file anymore and instead it will keep on writing to the same file as it did before it was disabled.
    • The profiler now requires Rust nightly to compile.
    Source code(tar.gz)
    Source code(zip)
    memory-profiler-x86_64-unknown-linux-gnu.tgz(24.23 MB)
  • 0.5.0(Oct 7, 2019)

    Major changes:

    • Shadow stack based unwinding is now supported on stable Rust and turned on by default.
    • Systems where perf_event_open is unavailable (e.g. unpatched MIPS64 systems, docker containers, etc.) are now supported.
    • The mechanism for exception handling when using shadow stack based unwinding was completely rewritten using proper landing pads.
    • Programs which call longjmp/setjmp are now partially supported when using shadow stack based unwinding.
    • Shared objects dynamically loaded through dlopen are now properly handled.
    • Rust symbol demangling is now supported.
    • Fixed an issue where calling backtrace on certain architectures while using shadow stack based unwinding would crash the program.
    • The profiler can now be compiled with the jemalloc feature to use jemalloc instead of the system allocator.
    • The profiler can now be started and stopped programmatically through memory_profiler_start and memory_profiler_stop functions exported by libmemory_profiler.so. Those are equivalent to controlling the profiler through signals.
    Source code(tar.gz)
    Source code(zip)
    memory-profiler-x86_64-unknown-linux-gnu.tgz(23.39 MB)
  • 0.4.0(Jul 14, 2019)

    Major changes:

    • The profiler can now be compiled on Rust stable, with the caveat that the shadow stack based unwinding will be then disabled.
    • The profiler is now fully lazily initialized; if disabled with MEMORY_PROFILER_DISABLE_BY_DEFAULT the profiler will not initialize itself nor create an output file.
    • The signal handler registration can now be disabled with MEMORY_PROFILER_REGISTER_SIGUSR1 and MEMORY_PROFILER_REGISTER_SIGUSR2.
    • When the profiling is disabled at runtime it will more thoroughly deinitialize itself, and when reenabled it will create a new output file instead of continuing to write data to the old one.
    • The embedded server is now disabled by default and can be reenabled with the MEMORY_PROFILER_ENABLE_SERVER environment variable.
    • The base port of the embedded server can now be set with the MEMORY_PROILER_BASE_SERVER_PORT environment variable.
    • The MEMORY_PROFILER_OUTPUT now supports an %n placeholder.
    • The GUI has now a graph which shows allocations and deallocations per second.
    Source code(tar.gz)
    Source code(zip)
    memory-profiler-x86_64-unknown-linux-gnu.tgz(23.82 MB)
  • 0.3.0(Jun 6, 2019)

  • 0.2.0(May 28, 2019)

    Major changes:

    • Massive performance improvements. In the average case on AMD64 the cost per a single allocation was cut down to 20%; on ARM it was cut down to less than 50%.
    • The profiler no longer crashes when a memory operation is triggered from a destructor of an object residing in TLS.
    • The gathered timestamps are no longer as precise as they were; they should be at most off by ~250ms if your application isn't making a lot of allocations. You can restore the previous behavior if you need it by setting MEMORY_PROFILER_PRECISE_TIMESTAMPS to 1 at the cost of extra CPU time.
    Source code(tar.gz)
    Source code(zip)
    memory-profiler-x86_64-unknown-linux-gnu.tgz(24.29 MB)
Owner
Koute
Koute
Sqrt OS is a simulation of an OS scheduler and memory manager using different scheduling algorithms including Highest Priority First (non-preemptive), Shortest Remaining Time Next, and Round Robin.

A CPU scheduler determines an order for the execution of its scheduled processes; it decides which process will run according to a certain data structure that keeps track of the processes in the system and their status. A process, upon creation, has one of the three states: Running, Ready, Blocked (doing I/O, using other resources than CPU or waiting on unavailable resource).

Abdallah Hemdan 18 Apr 15, 2022
Remote Download and Memory Execute for shellcode framework

RmExecute Remote Download and Memory Execute for shellcode framework 远程下载并内存加载的ShellCode框架,暂不支持X64 参(抄)考(袭)项目 windows下shellcode提取模板的实现 主要抄袭来源,直接使用这位大佬

null 52 Dec 25, 2022
A fast image processing library with low memory needs.

libvips : an image processing library Introduction libvips is a demand-driven, horizontally threaded image processing library. Compared to similar lib

libvips 7.5k Dec 29, 2022
PoC memory injection detection agent based on ETW, for offensive and defensive research purposes

TiEtwAgent - ETW-based process injection detection This project was created to research, build and test different memory injection detection use cases

Filip Olszak 188 Dec 26, 2022
Scans all running processes. Recognizes and dumps a variety of potentially malicious implants (replaced/implanted PEs, shellcodes, hooks, in-memory patches).

Scans all running processes. Recognizes and dumps a variety of potentially malicious implants (replaced/implanted PEs, shellcodes, hooks, in-memory patches).

hasherezade 1.5k Jan 4, 2023
the checkra1n set of tools targeting bare metal, Linux and Windows

Universal toolchain Low-effort cross-compiling for the masses. What's Universal toolchain? It's a collection of sysroots and shell scripts in such a w

null 67 Jan 5, 2023
Linux Kernel module-less implant (backdoor)

0 KOPYCAT - Linux Kernel module-less implant (backdoor) Usage $ make $ sudo insmod kopycat.ko insmod: ERROR: could not insert module kopycat.ko: Inapp

Ilya V. Matveychikov 52 Dec 28, 2022
An asynchronous directory file change watcher module for Windows, macOS and Linux wrapped for V

A V module for asynchronously watching for file changes in a directory. The module is essentially a wrapper for septag/dmon. It works for Windows, macOS and Linux.

null 18 Dec 14, 2022
Atomically exchange two files in Linux

Atomically exchange two files in Linux.

David Pape 9 Aug 4, 2022
A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename.

whereami A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename. usag

Blackle Morisanchetto 3 Sep 24, 2022
Orbit, the Open Runtime Binary Instrumentation Tool, is a standalone C/C++ profiler for Windows and Linux

Orbit, the Open Runtime Binary Instrumentation Tool, is a standalone C/C++ profiler for Windows and Linux. Its main purpose is to help developers visualize the execution flow of a complex application.

Google 3k Dec 30, 2022
Minimal Linux Live (MLL) is a tiny educational Linux distribution, which is designed to be built from scratch by using a collection of automated shell scripts. Minimal Linux Live offers a core environment with just the Linux kernel, GNU C library, and Busybox userland utilities.

Minimal Linux Live (MLL) is a tiny educational Linux distribution, which is designed to be built from scratch by using a collection of automated shell scripts. Minimal Linux Live offers a core environment with just the Linux kernel, GNU C library, and Busybox userland utilities.

John Davidson 1.3k Jan 8, 2023
The Hoard Memory Allocator: A Fast, Scalable, and Memory-efficient Malloc for Linux, Windows, and Mac.

The Hoard Memory Allocator Copyright (C) 1998-2020 by Emery Berger The Hoard memory allocator is a fast, scalable, and memory-efficient memory allocat

Emery Berger 927 Jan 2, 2023
microprofile is an embeddable profiler

microprofile Microprofile is a embeddable profiler in a few files, written in C++ Microprofile is hosted on github: https://github.com/jonasmr/micropr

Jonas Meyer 1.2k Dec 29, 2022
Single C file, Realtime CPU/GPU Profiler with Remote Web Viewer

Remotery A realtime CPU/GPU profiler hosted in a single C file with a viewer that runs in a web browser. Supported Platforms: Windows Windows UWP (Hol

Celtoys 2.4k Jan 8, 2023
Code profiler based on Frida

Code Profiler Based on Frida This repository contains the code to profile LIEF functions with Frida. Get Started Make sure to download the right versi

LIEF 26 Sep 12, 2022
Palanteer is a set of high performance visual profiler, debugger, tests enabler for C++ and Python

Palanteer is a set of lean and efficient tools to improve the general software quality, for C++ and Python programs.

Damien Feneyrou 1.9k Dec 29, 2022
Optick: C++ Profiler For Games

C++ Profiler For Games

Vadim Slyusarev 2.5k Jan 7, 2023
A small program that acts as a C profiler.

Simple Performance Test Description This is a simple program in C for performance testing which only works for x86 and x86_64 systems. A for loop is e

Christian Deacon 8 Oct 24, 2022
Parca-agent - eBPF based always-on profiler auto-discovering targets in Kubernetes and systemd, zero code changes or restarts needed!

Parca Agent Parca Agent is an always-on sampling profiler that uses eBPF to capture raw profiling data with very low overhead. It observes user-space

Parca 254 Jan 1, 2023