Allocscope - a memory tracking tool

Overview

allocscope banner

allocscope

a memory tracking tool

allocscope is a tool for tracking down where the most egregiously large allocations are occurring in a C, C++ or Rust codebase. It is particilarly intendend to be useful for developers who want to get a handle on excessive allocations and are working in a large codebase with multiple contributors with allocations occuring in many modules or libraries.

It is composed of two commands:

allocscope-trace attaches to another process as a debugger. By using breakpoints on memory allocation functions such as malloc it tracks allocations made by that process. During the trace, the callstack of all allocations are recorded to an .atrace file. Tracing programs which spawn multiple threads and tracing calls through shared libraries are supported. You can spawn a process to trace by specifying a full commandline to allocscope-trace, or you can attach to an existing running process.

allocscope-view reads the .atrace file produced by allocscope-trace. It presents a summary of all allocations made in a call tree format, which can be sorted by largest concurrent allocation, total number of blocks, number of unfreed allocation blocks, or the sequence of the allocation. The summary can be navigated interactively through a curses-based terminal user interface, or a text report suitable for non-interactive use can be generated.

Installing prebuilt binaries

The easiest way to get started with allocscope is to install prebuilt binaries.

To install the latest version:

curl -s https://allocscope.com/install.sh | sudo sh

Currently only Linux on x86_64 processors is supported, but I'd like to support more operating systems and processors in the future.

Getting started

While it will likely be most useful to use allocscope on a program with symbols, which you have compiled yourself, you can verify that it functions correctly by performing a trace on a standard system command, such as ls:

allocscope-trace ls -l
allocscope-view ls.atrace

Building from source

On recent Ubuntu releases, allocscope can be built from source with the following sequence of commands:

apt-get update
apt-get install cargo git libclang-dev libiberty-dev libncurses-dev libsqlite3-dev libunwind-dev
git clone https://github.com/matt-kimball/allocscope.git
cd allocscope
cargo install --path allocscope-trace
cargo install --path allocscope-view

Statically linked binaries can also be built using the build-static/build.sh script, though this requires Docker installed on the build system.

Support development

If you find allocscope useful, please consider supporting development.

Visit https://allocscope.com/support

License

allocscope is licensed GNU General Public License version 3.

You might also like...
A memory-based evasion technique which makes shellcode invisible from process start to end.
A memory-based evasion technique which makes shellcode invisible from process start to end.

phantom A memory-based evasion technique which makes shellcode invisible from process start to end. Motivation ShellGhost Offensive Edition, and rust!

High-performance QEMU memory and instruction tracing
High-performance QEMU memory and instruction tracing

Cannoli Cannoli is a high-performance tracing engine for qemu-user. It can record a trace of both PCs executed, as well as memory operations. It consi

A tool of generating and viewing dice roll success distributions.

AZDice A GUI tool for generating and visualising dice roll probability distributions. Aims Intended to help people trying to get game balance just rig

Simple tool for scaffolding

quick-skeleton tldr; Lightweight replacement for yeoman or slush. Powered by handlebars. This is a scaffolding tool to save you hours of writing boile

A nifty commandline tool to manage your workstation.

workstation It's a nifty commandline rust tool to make you sit slightly away from your screen by blacking out the screen if you come too close and loc

A command-line tool collection to assist development written in RUST

dtool dtool is a command-line tool collection to assist development Table of Contents Description Usage Tips Installation Description Now dtool suppor

A low-ish level tool for easily writing and hosting WASM based plugins.

A low-ish level tool for easily writing and hosting WASM based plugins. The goal of wasm_plugin is to make communicating across the host-plugin bounda

A cross platform tool which instantly notifies about COVID vaccine availability.
A cross platform tool which instantly notifies about COVID vaccine availability.

πŸ’‰ CoWIN Notifier 😷 A cross-platform tool written in rust, which instantly notifies users about COVID-19 vaccine availability at their regions. Curre

A small tool to clone git repositories to a standard location, organised by domain name and path.

A small tool to clone git repositories to a standard location, organised by domain name and path. Runs on BSD, Linux, macOS, Windows, and more.

Comments
  • Failing to run on binaries created by bevy

    Failing to run on binaries created by bevy

    Hello, wrote on the reddit post as well.

    Reproduce

    Trying to run this on bevy crates fails, i have not tested it very thoroughly, but to reproduce you could:

    git clone https://github.com/bevyengine/bevy.git
    cd bevy
    cargo build --example 3d_scene
    allocscope-trace target/debug/example/3d_scene
    

    expected behaviour

    A 3d scene with a box should show up, standing still, nothing else, quitting the software will stop the process, and the atrace can be inspected.

    actual behaviour

    the 3D scene will not show up, and allocscope-trace will say and show nothing. ctrl+c will quit it though running it for a while will create an atrace file though, and that can be inspected ( sometimes crash, but not easily reproduced, said something about higher number? dont remember )

    opened by TotalKrill 1
Releases(v0.1.0)
Owner
Matt Kimball
Matt Kimball
A VtubeStudio plugin that allows iFacialMocap to stream data to the app, enabling full apple ARkit facial tracking to be used for 2D Vtuber models.

facelink_rs A VtubeStudio plugin that allows iFacialMocap to stream data to the app, enabling full apple ARkit facial tracking to be used for 2D Vtube

Slashscreen 2 May 6, 2022
Rust binding of fortran Limited memory LBFGS subroutine

lbfgs-sys Rust binding of fortran L-BFGS-B subroutine. The orginal fortran subroutine is distributed under BSD-3 license. To know more about the condi

Naushad Karim 10 Sep 23, 2022
This crate allows writing a struct in Rust and have it derive a struct of arrays layed out in memory according to the arrow format.

Arrow2-derive - derive for Arrow2 This crate allows writing a struct in Rust and have it derive a struct of arrays layed out in memory according to th

Jorge Leitao 29 Dec 27, 2022
A memory efficient immutable string type that can store up to 24* bytes on the stack

compact_str A memory efficient immutable string type that can store up to 24* bytes on the stack. * 12 bytes for 32-bit architectures About A CompactS

Parker Timmerman 342 Jan 2, 2023
bustd is a lightweight process killer daemon for out-of-memory scenarios for Linux!

bustd: Available memory or bust! bustd is a lightweight process killer daemon for out-of-memory scenarios for Linux! Features Small memory usage! bust

Pop!_OS 8 Oct 6, 2022
A rust library that makes reading and writing memory of the Dolphin emulator easier.

dolphin-memory-rs A crate for reading from and writing to the emulated memory of Dolphin in rust. A lot of internals here are directly based on aldela

Madison Barry 4 Jul 19, 2022
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 tempora

Koute 3.3k Dec 25, 2022
messloc is a drop in replacement for malloc that can transparently recover from memory fragmentation without any changes to application code.

messloc is a drop in replacement for malloc that can transparently recover from memory fragmentation without any changes to application code. Goals Al

null 11 Dec 10, 2022
Translate C++/Rust type into C type with the same memory layout

clayout, translate C++/Rust type into C type with the same memory layout. Generally, clayout is used together with bpftrace. clayout is developed on d

盏一 11 Nov 17, 2022
A memory visualizer in Rust (ptrace + userfaultfd)

mevi A memory visualizer for Linux 5.7+ Made for this video: https://www.youtube.com/watch?v=DpnXaNkM9_M Prerequisite The vm.unprivileged_userfaultfd

amos 519 Apr 17, 2023