4
4
### a memory tracking tool
5
5
6
6
allocscope is a tool for tracking down where the most egregiously large allocations are occurring
7
- in a C, C++ or Rust codebase.
7
+ in a C, C++ or Rust codebase. It is particilarly intendend to be useful for developers who want to
8
+ get a handle on excessive allocations and are working in a large codebase with multiple
9
+ contributors with allocations occuring in many modules or libraries.
8
10
9
11
It is composed of two commands:
10
12
11
13
` allocscope-trace ` attaches to another process as a debugger. By using breakpoints on memory
12
- allocation functions such as ` malloc ` it tracks allocations made by that process.
14
+ allocation functions such as ` malloc ` it tracks allocations made by that process. During the
15
+ trace, the callstack of all allocations are recorded to an ` .atrace ` file. Tracing programs
16
+ which spawn multiple threads and tracing calls through shared libraries are supported. You can
17
+ spawn a process to trace by specifying a full commandline to ` allocscope-trace ` , or you can
18
+ attach to an existing running process.
13
19
14
- ` allocscope-view ` reads a trace file produced by ` allocscope-trace ` . It presents a summary of all
15
- allocations made in a call tree format, which can be sorted by largest concurrent allocation,
16
- total number of blocks, or number of unfreed allocation blocks.
20
+ ` allocscope-view ` reads the ` .atrace ` file produced by ` allocscope-trace ` . It presents a summary
21
+ of all allocations made in a call tree format, which can be sorted by largest concurrent
22
+ allocation, total number of blocks, number of unfreed allocation blocks, or the sequence of
23
+ the allocation. The summary can be navigated interactively through a curses-based terminal user
24
+ interface, or a text report suitable for non-interactive use can be generated.
17
25
18
- # Installing prebuilt binaries
26
+ ## Installing prebuilt binaries
19
27
20
28
The easiest way to get started with allocscope is to install prebuilt binaries.
21
29
@@ -26,7 +34,18 @@ To install the latest version:
26
34
Currently only Linux on x86_64 processors is supported, but I'd like to support more operating systems
27
35
and processors in the future.
28
36
29
- # Building from source
37
+ ## Getting started
38
+
39
+ While it will be likely be most useful to use allocscope on a program with symbols, which you
40
+ have compiled yourself, you can verify that it functions correctly by performing a trace on a
41
+ standard system command, such as ` ls ` :
42
+
43
+ ```
44
+ allocscope-trace ls -l
45
+ allocscope-view ls.atrace
46
+ ```
47
+
48
+ ## Building from source
30
49
31
50
On recent Ubuntu releases, allocscope can be built from source with the following sequence
32
51
of commands:
@@ -40,12 +59,15 @@ cargo install --path allocscope-trace
40
59
cargo install --path allocscope-view
41
60
```
42
61
43
- # Support development
62
+ Statically linked binaries can also be built using the ` build-static/build.sh ` script, though this requires
63
+ Docker installed on the build system.
64
+
65
+ ## Support development
44
66
45
67
If you find allocscope useful, please consider supporting development.
46
68
47
69
Visit https://allocscope.com/support
48
70
49
- # License
71
+ ## License
50
72
51
73
allocscope is licensed GNU General Public License version 3.
0 commit comments