microsoft / microsoft/mimalloc

Question about mi_collect

Open
#536 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
13.4k
Forks
1.2k
Avg merge
4d 45m
Merged PRs (30d)
13

Description

In MoarVM, whenever we do what we call a "full" garbage collection run, we call `malloc_trim()` if it's available. I thought it would make sense to now also call `mi_collect(true)`. However, while testing this out I noticed some odd interaction with heaptrack and our `--full-cleanup` runtime option (which frees everything upon exit, instead of just letting the OS clean up). I use the `--full-cleanup` option when I'm profiling with heaptrack, so it gives an accurate account of leaks (i.e., we try for no leaks with `--full-cleanup`). Using a heaptrack that I've added support for mimalloc to, everything looks good normally. However, when I added the `mi_collect(true)` call, now even with `--full-cleanup` heaptrack reports massive leaks. Is there something I should add to my patch to heaptrack to get it to properly handle `mi_collect`?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the interaction between mi_collect(true), malloc_trim(), heaptrack, and MoarVM's --full-cleanup option. Compare heaptrack's results with and without mi_collect(true), then determine whether the heaptrack mimalloc support needs adjustment so full cleanup reports allocations accurately.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
performance, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.