Giter Site home page Giter Site logo

debug-allocations's Introduction

Trace allocations with a LD_PRELOAD library

Build the library with:

gcc --shared -nostartfiles -fPIC -g log-malloc.c -o log-malloc.so -lpthread -ldl

To trace a program, run:

LD_PRELOAD=./log-malloc.so command args ...

Example, showing a 24 bytes malloc along with the backtrace of its call site.

$ LD_PRELOAD=./log-malloc.so jk run test-issue-0071.js
[...]

malloc 24        0x22a48e0 [bt] Execution path:
./log-malloc.so(+0xb4e)[0x7f4e07de4b4e]
./log-malloc.so(malloc+0xa3)[0x7f4e07de4c6b]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_Znwm+0x18)[0x7f4e078d2e78]
jk(_ZN2v88internal28DefaultDeserializerAllocator17DecodeReservationESt6vectorINS0_14SerializedData11ReservationESaIS4_EE+0xdf)[0x1061c7f]
jk(_ZN2v88internal12DeserializerINS0_28DefaultDeserializerAllocatorEEC2IKNS0_12SnapshotDataEEEPT_b+0x172)[0xd5e822]
jk(_ZN2v88internal8Snapshot10InitializeEPNS0_7IsolateE+0x11f)[0xd5c90f]
jk(_ZN2v87Isolate10InitializeEPS0_RKNS0_12CreateParamsE+0x11a)[0xa0082a]
jk(_ZN2v87Isolate3NewERKNS0_12CreateParamsE+0x2a)[0xa009da]
jk(worker_new+0xf3)[0x9ce2d3]
jk(_cgo_930f4c6fb697_Cfunc_worker_new+0x16)[0x9ccf46]
jk[0x6dcc00]

[...]

debug-allocations's People

Contributors

dlespiau avatar

Stargazers

 avatar

Watchers

 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.