-
Notifications
You must be signed in to change notification settings - Fork 6
feat: support non libc allocators #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
659acd9 to
68bf77a
Compare
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request enhances the memtrack eBPF-based memory tracking system to support multiple memory allocators beyond the standard libc. The changes enable tracking of statically and dynamically linked allocators like jemalloc and mimalloc, which are commonly used in Rust and other performance-critical applications.
Changes:
- Refactored IPC connection initialization to happen before creating the Tracker instance to avoid timeouts
- Added comprehensive allocator discovery system supporting libc, jemalloc, and mimalloc (both static and dynamic linking)
- Extended eBPF probe attachment to support allocator-specific symbol names and added memalign tracking
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/memtrack/src/main.rs | Reordered IPC connection to happen before tracker initialization; added event counter logging |
| crates/memtrack/src/libc.rs | Removed old libc-specific path discovery (replaced by new allocators module) |
| crates/memtrack/src/lib.rs | Updated exports to include new AllocatorKind and AllocatorLib types |
| crates/memtrack/src/ebpf/tracker.rs | Updated to use new allocator discovery system instead of libc-specific logic |
| crates/memtrack/src/ebpf/memtrack.rs | Refactored probe attachment macros; added allocator-specific probe attachment methods |
| crates/memtrack/src/ebpf/c/memtrack.bpf.c | Added memalign probe support |
| crates/memtrack/src/allocators/mod.rs | New allocator discovery framework defining AllocatorKind enum and AllocatorLib struct |
| crates/memtrack/src/allocators/dynamic.rs | Implements discovery of dynamically linked allocator libraries across various Linux distributions |
| crates/memtrack/src/allocators/static_linked.rs | Implements discovery of statically linked allocators in CodSpeed analysis binaries |
| crates/memtrack/Cargo.toml | Added object crate dependency for ELF symbol parsing |
| Cargo.lock | Updated with object crate dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| AllocatorKind::Jemalloc => { | ||
| // Try standard names (jemalloc may export these as drop-in replacements) | ||
| let _ = self.attach_standard_probes(lib_path); | ||
| self.attach_jemalloc_probes(lib_path) | ||
| } | ||
| AllocatorKind::Mimalloc => { | ||
| // Try standard names (mimalloc may export these as drop-in replacements) | ||
| let _ = self.attach_standard_probes(lib_path); | ||
| self.attach_mimalloc_probes(lib_path) |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attach_standard_probes method is used differently for Libc vs. non-libc allocators. For Libc (line 298), the result is returned and can fail the operation. However, for Jemalloc and Mimalloc (lines 302, 307), the result is explicitly discarded with let _ = .... This inconsistency could be confusing. Consider documenting why the result is discarded for non-libc allocators, or refactoring to make the intent clearer (e.g., a separate method like try_attach_standard_probes that never fails).
GuillaumeLagrange
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
olgtm
68bf77a to
7da9c3e
Compare
489d08d to
1f76446
Compare
memaligncalls