From 9c73aa494170bb14b7e8a3b32d1f48d457c6237b Mon Sep 17 00:00:00 2001 From: Amir Mujacic Date: Wed, 29 Jul 2026 19:55:14 +0200 Subject: [PATCH 1/2] fix(native): Reduce the size of native-generated minidumps on Windows --- .../native/minidump/sentry_minidump_windows.c | 12 ++++++++++-- tests/test_integration_native.py | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/backends/native/minidump/sentry_minidump_windows.c b/src/backends/native/minidump/sentry_minidump_windows.c index 3852de28b..dbd409ed6 100644 --- a/src/backends/native/minidump/sentry_minidump_windows.c +++ b/src/backends/native/minidump/sentry_minidump_windows.c @@ -56,8 +56,16 @@ sentry__write_minidump( break; case SENTRY_MINIDUMP_MODE_SMART: - dump_type - = MiniDumpWithIndirectlyReferencedMemory | MiniDumpWithDataSegs; + // Only indirectly-referenced memory: dbghelp walks the stack and + // registers and captures a small window around each pointer that + // lands in mapped memory. We deliberately omit MiniDumpWithDataSegs + // here: it writes the entire writable data segment of *every* loaded + // module (all DLL .data/.bss), which is uncapped and dominates dump + // size — for large module graphs it produces dumps 10-30x larger + // than intended. Global/static data is rarely needed for crash + // triage; callers that want it can opt in via + // sentry_options_set_minidump_flags() or MODE_FULL. + dump_type = MiniDumpWithIndirectlyReferencedMemory; break; case SENTRY_MINIDUMP_MODE_FULL: diff --git a/tests/test_integration_native.py b/tests/test_integration_native.py index 92b29c185..6375b13ca 100644 --- a/tests/test_integration_native.py +++ b/tests/test_integration_native.py @@ -793,8 +793,8 @@ def test_native_smart_mode_captures_indirect_heap_memory(cmake, httpserver): appends a chunk around each writable-heap hit to MemoryListStream. * Windows: the native backend passes - ``MiniDumpWithIndirectlyReferencedMemory | MiniDumpWithDataSegs`` - to ``MiniDumpWriteDump`` so the OS does the equivalent scan. + ``MiniDumpWithIndirectlyReferencedMemory`` to + ``MiniDumpWriteDump`` so the OS does the equivalent scan. The minimal-mode fallback on macOS (when ``task_for_pid`` is blocked by the sandbox) silently breaks the SMART-mode contract by From 2a9d8860ba1bdf437466f08c3595af6eedbe3d06 Mon Sep 17 00:00:00 2001 From: Amir Mujacic Date: Wed, 29 Jul 2026 20:08:54 +0200 Subject: [PATCH 2/2] Fix style/changelog --- CHANGELOG.md | 2 ++ src/backends/native/minidump/sentry_minidump_windows.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 488c3f9a5..659c08705 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,9 @@ ## Unreleased **Fixes**: + - Honor checks before launching crash reporter ([#1906](https://github.com/getsentry/sentry-native/pull/1906)) +- Reduce the size of native-generated minidumps on Windows ([#1929](https://github.com/getsentry/sentry-native/pull/1929)) ## 0.16.0 diff --git a/src/backends/native/minidump/sentry_minidump_windows.c b/src/backends/native/minidump/sentry_minidump_windows.c index dbd409ed6..6ab23965f 100644 --- a/src/backends/native/minidump/sentry_minidump_windows.c +++ b/src/backends/native/minidump/sentry_minidump_windows.c @@ -59,11 +59,11 @@ sentry__write_minidump( // Only indirectly-referenced memory: dbghelp walks the stack and // registers and captures a small window around each pointer that // lands in mapped memory. We deliberately omit MiniDumpWithDataSegs - // here: it writes the entire writable data segment of *every* loaded - // module (all DLL .data/.bss), which is uncapped and dominates dump - // size — for large module graphs it produces dumps 10-30x larger - // than intended. Global/static data is rarely needed for crash - // triage; callers that want it can opt in via + // here: it writes the entire writable data segment of *every* + // loaded module (all DLL .data/.bss), which is uncapped and + // dominates dump size — for large module graphs it produces dumps + // 10-30x larger than intended. Global/static data is rarely needed + // for crash triage; callers that want it can opt in via // sentry_options_set_minidump_flags() or MODE_FULL. dump_type = MiniDumpWithIndirectlyReferencedMemory; break;