microsoft / microsoft/mimalloc

document that __builtin_malloc (etc) disrupt function call overrides since there is no function call

Open
#589 0 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

It seems that the main github page that offers the LD_PRELOAD (etc) methodologies should mention that if a library or the program itself optimize malloc() (etc) calls to their __builtin variants (for inlining), those calls won't be redirected to mimalloc.

In my particular case I'm trying to capture posix_memalign calls from a 3rd party lib and I suspect it was compiled with something like __builtin_posix_memalign. It took me hours to form this tentative conclusion so I think documentation would be appreciated.

While my conclusion is only tentative regarding posix_memalign (since my compiler doesn't have it), I did test that __builtin_malloc disrupts malloc.

EDIT: Even better, help users figure out how to turn off only allocation-related builtins for their compiler. E.g. -fno-builtin-malloc ... (etc)

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

Review the main GitHub page's LD_PRELOAD documentation and its explanation of allocation interception. Document that compiler-generated __builtin_malloc and related calls may not be redirected, and explain how allocation-related builtins can be disabled, including the -fno-builtin-malloc example. Done means users can understand this limitation and find the relevant compiler guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.