microsoft / microsoft/mimalloc

Difference between mimalloc's freed report and valgrind --leak-check=full

Open
#509 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
13.4k
Forks
1.2k
Avg merge
4d 45m
Merged PRs (30d)
13

Description

I have been investigating whether we should use mimalloc for [MoarVM](https://github.com/MoarVM/MoarVM) (the primary backend for the [Rakudo](https://github.com/rakudo/rakudo) Raku compiler) and initial results are very promising. However, am wondering about a difference I see between the stats reported when I use `MIMALLOC_SHOW_STATS=1` with `LD_PRELOAD=/path/to/libmimalloc-debug.so` compared to `valgrind --leak-check=full`. For a minimal test case `MIMALLOC_SHOW_STATS=1 LD_PRELOAD=/path/to/libmimalloc-debug.so raku --full-cleanup -e ''` (where the `--full-cleanup` flag to `raku` tells the VM to free every thing on exit instead of just letting the OS cleanup), mimalloc reports 1.2 MiB total for `current`. However, for `valgrind --leak-check=full raku --full-cleanup -e ''`, valgrind reports `All heap blocks were freed -- no leaks are possible`. Is this just an artifact of using dynamic loading? Or could there be some other reason?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the minimal Raku command with MIMALLOC_SHOW_STATS and the Valgrind leak-check command, then compare what each tool counts as live memory. No source files or tests are named; done means explaining the 1.2 MiB discrepancy or identifying a concrete allocator accounting issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
performance
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.