(comments)

原始链接: https://news.ycombinator.com/item?id=44025979

Poireau is a sampling allocation debugger aiming to help identify why a program's memory usage grows over time, particularly useful for flagging long-lived allocations that contribute to memory leaks. One challenge is efficiently determining during `free()` whether a given pointer was sampled. The Hacker News discussion highlights two approaches: Poireau reportedly segregates sampled pointers into different memory address spaces. Alternatively, Sciagraph profiles allocations by ensuring sampled allocations are a minimum size (e.g., 16KiB), allowing `free()` to identify them using `malloc_usable_size()`. This introduces potential false positives but avoids costly lookups. Alignment is also mentioned as a potential heuristic. The tool is valuable for pinpointing the source of increasing memory consumption, as exemplified by diagnosing memory growth in a Ruby process.

相关文章
  • Poireau:一个抽样分配调试器 2025-05-22
  • (评论) 2025-05-23
  • (评论) 2025-05-21
  • 2025-05-15
  • (评论) 2025-05-17

  • 原文
    Hacker News new | past | comments | ask | show | jobs | submit login
    Poireau: A Sampling Allocation Debugger (github.com/backtrace-labs)
    11 points by luu 1 day ago | hide | past | favorite | 2 comments










    One key question in these sort of things is how free() works: it is given a pointer, and it has to decide whether this was sampled or not, with _minimum_ effort.

    Poireau does this, IIRC, by putting the pointers it sampled in a different memory address.

    Sciagraph (https://sciagraph.com), a profiler I created, uses allocation size. If an allocation is chosen for sampling the profiler makes sure its size is at least 16KiB. Then free() will assume that any allocation 16KiB or larger is sampled. This may not be true, it might be false positive, but it means you don't have to do anything beyond malloc_usable_size() if you have free() on lots and lots of small allocations. A previous iteration used alignment as a heuristic, so that's another option.



    Recently saw this through https://discuss.systems/@pkhuong/114532017716618023 which summaries why this would be useful:

    > Flagging old live (i.e., potentially immortal) allocations is easier (https://github.com/backtrace-labs/poireau) and more closely matches the goal of identifying why the heap grows instead of entering a steady state.

    Ej. Why is Sidekiq memory consumption growing over time.







    Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact



    Search:
    联系我们 contact @ memedata.com