microsoft / microsoft/mimalloc

mi_malloc is called before mimalloc-override.dll:DllMain (at least in mimalloc-override-test)

Open
#555 3 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

Hello,

I am running mimalloc-override-test (in Debug, x64 on Windows). I put a breakboint in mi_malloc (alloc.c) and one in DllMain (init.c) and noticed mi_malloc breakpoint is hit several time before DllMain is reached.

I am puzzle about this situation. mi_malloc is called by [External Code] so I could not investigate further.

My Context: I would like to run some initialization code to instrument mimalloc, the initialization code must happen before any call to malloc/mi_malloc. The fact mi_malloc is even called before DllMain let me think why I want to do is maybe impossible.

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 report in mimalloc-override-test using a Debug x64 Windows build, then inspect the breakpoints in alloc.c and init.c around mi_malloc and DllMain. Trace the external call path far enough to explain why allocation occurs before DLL initialization, and document whether that ordering is expected or requires a change.

Written by the indexing model from the issue text.

Assessment

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