feat(monitoring): robust macOS memory usage with TASK_VM_INFO fallback - #6
Merged
Conversation
yogeshnimangre007
force-pushed
the
fix/memory-usage-fix
branch
from
August 13, 2025 14:36
b25e745 to
9898ced
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(monitoring): robust macOS memory usage with TASK_VM_INFO fallback
Summary
Adds reliable process memory tracking on macOS (Intel & Apple Silicon). Previously the monitor endpoint sometimes returned:
due to a rigid struct definition or
task_infoflavor failure.Changes
mach_task_basic_infostruct layout.natural_t(u32) sizing.TASK_VM_INFOwhen basic flavor fails.Expected JSON
Verification (macOS)
Should show
available: true. If not, debug logs will contain:mach_task_basic_info failedTASK_VM_INFO failedEdge Cases
available:false(previous behavior)Performance
Negligible impact. Memory probe still cached for 5s.
Risks
Future Improvements (Optional)
proc_pid_rusagethird fallback.Testing
#[cfg(target_os = "macos")]).Notes
No external dependencies added; pure FFI approach. Safe failure path maintained.
Closes intermittent “memory tracking unavailable” observations on macOS.