Skip to content

Conversation

@not-matthias
Copy link
Member

  • feat(memtrack): accept IPC before creating tracker to avoid timeouts
  • chore: print number of events written to disk
  • feat(memtrack): track memalign calls
  • feat(memtrack): support dynamically and statically linked allocators

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 14, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing cod-1715-support-non-libc-allocators (8d59751) with main (1ac1eae)

Summary

✅ 4 untouched benchmarks

Copy link

Copilot AI left a 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.

Comment on lines 300 to 301
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)
Copy link

Copilot AI Jan 14, 2026

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).

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@GuillaumeLagrange GuillaumeLagrange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

olgtm

@not-matthias not-matthias changed the title cod 1715 support non libc allocators feat: support non libc allocators Jan 14, 2026
@not-matthias not-matthias force-pushed the cod-1715-support-non-libc-allocators branch from 68bf77a to 7da9c3e Compare January 14, 2026 18:20
@not-matthias not-matthias force-pushed the cod-1715-support-non-libc-allocators branch from 489d08d to 1f76446 Compare January 14, 2026 18:38
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.

3 participants