Skip to content

feat: enable memory profiling#1266

Draft
danielsn wants to merge 1 commit intomicrosoft:mainfrom
danielsn:dsn/memory-profiler
Draft

feat: enable memory profiling#1266
danielsn wants to merge 1 commit intomicrosoft:mainfrom
danielsn:dsn/memory-profiler

Conversation

@danielsn
Copy link
Copy Markdown

@danielsn danielsn commented Apr 16, 2026

This is a draft proposal to add memory allocation and live heap profiling to mimalloc, following the discussion in #1070 .

For allocation profiling, this provides a callback that could be used to trigger the probe for an external profiler, or to directly sample and store the values for in-process profiling.

Supporting live-heap profiling requires a cheap way of knowing whether a given pointer was tracked when free is called. Doing so externally turns out to be surprisingly expensive, as even a hash-table incurs cache misses, which are avoided if the metadata lives on the same cache line as an allocator data stucture that will already be read as part of the free operation. In this case, the on_free callback could either do in-process or out-of-process untracking of the object. In the common case where there is no tracked object on the page, this is a single branch on data that is already in cache.

@danielsn danielsn force-pushed the dsn/memory-profiler branch 2 times, most recently from a77e8ad to 6cbb5b3 Compare April 17, 2026 19:13
@danielsn
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Datadog"

@danielsn danielsn force-pushed the dsn/memory-profiler branch from 50aa760 to 0a526c0 Compare April 17, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant