Hacker News new | ask | show | jobs
by alschwalm 1223 days ago
Interesting approach. How is performance compared to something like https://github.com/koute/bytehound
2 comments

Bytehound author here.

Just from a cursory look at the README:

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

Looks like it's using breakpoints so I'd expect it to be orders of magnitude slower. And looking at the source code it's also using `libunwind`, so even if it wasn't using breakpoints it'd still be at least another order of magnitude slower since Bytehound has a custom unwinder that's specially optimized for this purpose.

One advantage it has is that it can be attached to an already running process; Bytehound can't do that. (I have ideas how I could do that, and it should be technically doable by dynamically injecting Bytehound's .so into the target process' address space, but so far I haven't needed it so I did not implement it)

Out of curiosity I ran a quick test on my private benchmark.

libbytehound.so (with extra debug assertions, because I'm too lazy to recompile in release mode): 4s

allocscope: did not finish after 4 minutes (I got bored waiting and CTRL+C'd it)

Yeah, that was my assumption as well, good to have it confirmed though. Thanks for your excellent work on bytehound!
Why is this being downvoted?

Edit: now this comment is being downvoted.