Support custom initialization hook in `mi_process_init`
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- C
- Sterne
- 13.6k
- Forks
- 1.2k
- Ø Merge
- 18 Std. 12 Min.
- Gemergte PRs (30 T.)
- 20
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoft/mimalloc
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Building mimalloc with `-Wundef` compiler flag logs many warnings on undefined macrosEvtl. vergeben @vstinner hat das vor 1 Tag übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
microsoft/mimalloc#1506 · 5 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
stale
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
microsoft/mimalloc#1113 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
microsoft/mimalloc#886 · 4 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
microsoft/mimalloc#368 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in microsoft/mimalloc
Ähnliche Issues
-
needs triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
389ds/389-ds-base#8157 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
coolsnowwolf/lede#14305 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Needs-Triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 2 Tagen