Giter Club home page Giter Club logo

tralloc's Introduction

tralloc: tracing allocator for Rust

This project allows you to log all the allocations to stderr, stdout or a file.

To use it, register the global allocator and activate it:

#![feature(global_allocator)]

extern crate tralloc;

#[global_allocator]
static GLOBAL: tralloc::Allocator = tralloc::Allocator{};

fn main() {
  tralloc::Allocator::write_to_stderr();
  tralloc::Allocator::activate();

  let s = String::from("Hello world!");

  let mut v = Vec::new();
  v.push(1);

The following will be printed:

00029801ACDA259B A 00007FB780500000 000000000000000C
00029801ACDB7EFB A 00007FB780500010 0000000000000010
00029801ACDBAAC1 D 00007FB780500010 0000000000000010
00029801ACDBCD09 D 00007FB780500000 000000000000000C

Columns:

  • time (monotonic, so not linked to any timezone)
  • A for allocation, D for deallocation
  • memory address
  • size

You can use the activate and deactivate methods to start and stop collection at any time.

Note

This repository is based on tracing_allocator. It was forked because of breaking changes in Rust internals and lack of communication from the original author.

tralloc's People

Contributors

geal avatar 19h avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.