google / tcmalloc

Apache License 2.0
4.41k stars 480 forks source link

Is there a debugging document of tcmalloc? #241

Closed RocketMaDev closed 5 months ago

RocketMaDev commented 5 months ago

The default malloc in glibc, ptmalloc had been profoundly studied and there are quite a few critical variables including main_arena to help researchers dig into heap. Is there a debugging document of tcmalloc? In that case I could debug tcmalloc easier.

junyer commented 5 months ago

It feels like "debugging" isn't quite the right word here – unless you are hacking on TCMalloc itself. tuning.md might be what you want?

RocketMaDev commented 5 months ago

Actually, yes. I'm testing security of tcmalloc.

junyer commented 5 months ago

I'm not sure how security testing relates to performance tuning, but okay then. :)

RocketMaDev commented 5 months ago

I might have made a improper response. I mean I'm "hacking on TCMalloc itself", instead of "tuning.md is what I want".

junyer commented 5 months ago

Oh, I see. In that case, I'm guessing that you mean that you want visibility into TCMalloc internal state? If so, stats.md may be closer to what you want.

ckennelly commented 5 months ago

https://google.github.io/tcmalloc/design covers the implementation in broad terms.

For specifics, reading the code is likely the best strategy.

RocketMaDev commented 5 months ago

That's useful. But if you could provide some global variables would help me more on debugging. :)