Support custom initialization hook in `mi_process_init`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by reading mi_process_init_once and the existing process initialization and OS memory management paths in mimalloc. The issue proposes a compile-time hook but leaves its placement and interaction with memory allocation options open, so first evaluate those constraints and discuss the design with maintainers. Done would mean an agreed hook design with a working example and tests showing initialization can use a caller-provided pool without fetching additional OS memory.
索引モデルが issue の本文から書いたものです。
説明
This question is similar to #1218 and #1228 (thank you for the fixes!!) in that we want to preallocate a fixed pool for mimalloc to use (and never ask the OS for more). Since our process can potentially malloc() before main (dynamic libs, etc) we need to set up our pool when that first allocation happens. It looks like the right place to do this would be towards the end of mi_process_init_once instead of fetching OS memory.
Since application code doesn't call mi_process_init directly, I think this would have to be a compile/link time thing, something like
static void mi_process_init_once(void) {
...
#ifdef MI_PROCESS_INIT_HOOK
extern void MI_PROCESS_INIT_HOOK(void);
MI_PROCESS_INIT_HOOK();
#endif
}
We compile the mimalloc staticlib with MI_PROCESS_INIT_HOOK=our_pool_setup and link it to the real function that mmap()s the pool, calls mi_manage_os_memory_ex(), and mi_option_set(). (Maybe the hook goes before the function tries to fetch OS memory?)
Is mimalloc open to upstreaming an idea like this? I can submit a PR once we have it working but I wanted to see if there's any alternative I'm missing or reasons that this wouldn't work.
- 主要言語
- C
- スター
- 13.6k
- フォーク
- 1.2k
- 平均マージ
- 18時間 12分
- マージ済み PR(30日)
- 20
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/mimalloc のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Building mimalloc with `-Wundef` compiler flag logs many warnings on undefined macros対応中かも @vstinner が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
microsoft/mimalloc#1506 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
stale
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
microsoft/mimalloc#1113 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
microsoft/mimalloc#886 · コメント 4 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
microsoft/mimalloc#368 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
microsoft/mimalloc の issue をすべて見る
似ている issue
-
needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
389ds/389-ds-base#8157 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
coolsnowwolf/lede#14305 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Needs-Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 2 日以内に返信