-
Notifications
You must be signed in to change notification settings - Fork 11
Comparing changes
Open a pull request
base repository: DataDog/java-profiler
base: main
head repository: DataDog/java-profiler
compare: jb/native_allocs
- 8 commits
- 21 files changed
- 2 contributors
Commits on Feb 25, 2026
-
Port native malloc/free profiling from async-profiler
- Add MallocTracer engine (GOT/PLT patching for malloc/calloc/realloc/free/posix_memalign/aligned_alloc) - Add BCI_NATIVE_MALLOC, MallocEvent, T_MALLOC/T_FREE JFR types - Add nativemem/nofree arguments - Add profiler.Malloc and profiler.Free JFR event metadata - Add recordEventOnly() for stack-trace-less free events - Add NativememProfilerTest and NofreeNativememProfilerTest Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 2a3ee88 - Browse repository at this point
Copy the full SHA 2a3ee88View commit details -
Fix pointer safety issues in MallocTracer
- Guard SAVE_IMPORT against NULL findImport return - Skip patchImport calls when corresponding _orig_* is NULL - Guard detectNestedMalloc against NULL _orig_malloc/_orig_calloc - Fix realloc(ptr,0)->NULL not recording free (POSIX: frees ptr) - Move _running=true after patchLibraries() to prevent hooks firing before patches are applied Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for a4a8eb2 - Browse repository at this point
Copy the full SHA a4a8eb2View commit details -
Fix stack traces for native malloc events
- Use putVar64 for call_trace_id in recordMallocSample (was putVar32, silently truncating 64-bit IDs → all malloc events had null stacks) - Walk Java stack via walkVM for BCI_NATIVE_MALLOC with cstack >= VM - Default cstack to CSTACK_VM; fall back gracefully if VMStructs absent - Add NativememProfilerTest and NofreeNativememProfilerTest smoke tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for fb72985 - Browse repository at this point
Copy the full SHA fb72985View commit details -
Add native memory profiling architecture doc
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for e6ae01f - Browse repository at this point
Copy the full SHA e6ae01fView commit details -
- vmEntry.cpp: use findLibraryByName for libc/libpthread; findJvmLibrary always returns libjvm on HotSpot so start_thread was never marked MARK_THREAD_ENTRY, causing break_no_anchor frames on aarch64 - CStackInjector: return first @valuesource entry as fallback when all modes are filtered (J9 with {"vm","vmx"}); prevents PreconditionViolation and lets isPlatformSupported() skip cleanly - TagContextTest: pin cstack=default; test covers context tagging, not stack-walking mode; CSTACK_VM is unreliable on musl x64 CI runners Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 4175162 - Browse repository at this point
Copy the full SHA 4175162View commit details -
Fix break_no_anchor for native threads with CSTACK_VM default
walkVM emits break_no_anchor when it reaches the top of a pure-native thread stack without a JavaFrameAnchor anchor. The previous fix used findLibraryByName("libc") which does a prefix match and can return the wrong library (e.g. libcap instead of libc.so.6), causing ThreadEntry- DetectionTest to regress on amd64 without fixing aarch64. Correct fix: scan ALL loaded native libs for isThreadEntry patterns once at init. This covers start_thread in glibc (libc.so.6 or libpthread.so.0 depending on version), musl (libc.musl-<arch>.so.1), Rust app binaries, etc., without any fragile library name lookup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Configuration menu - View commit details
-
Copy full SHA for 2e27e4b - Browse repository at this point
Copy the full SHA 2e27e4bView commit details -
Suppress break_no_anchor error frames for non-malloc events
For CPU/WALL samples, break_no_anchor is a normal stack-walk termination (pure-native threads, invalid anchor on aarch64 compiler threads). Emitting an error frame there breaks test assertions. Reserve the frame for MALLOC_SAMPLE where it carries diagnostic value. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 2b3b2d9 - Browse repository at this point
Copy the full SHA 2b3b2d9View commit details -
Drop break_no_anchor error frames entirely
The anchor-not-set condition (sp==0, invalid sp range) just means the JVM hasn't established a JavaFrameAnchor yet for this transition. The native frames already captured above are the complete information; the error frame adds no diagnostic value for any event type. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 84d3c57 - Browse repository at this point
Copy the full SHA 84d3c57View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff main...jb/native_allocs