Provide comprehensive real-time memory telemetry matching and extending macOS Activity Monitor, breaking down physical RAM into distinct categories, tracking swap memory usage, and monitoring macOS virtual memory pressure levels.
Priority
Critical (Core subsystem telemetry directly affecting system stability and responsiveness)
Dependencies
Depends on #1 (Core Application Architecture & Objective-C/SwiftUI Bridging Foundation)
Scope
Report total installed physical RAM.
Break down memory allocation into:
App Memory (active + internal anonymous pages)
Wired Memory (kernel and driver locked pages)
Compressed Memory (pages held in kernel compressor)
Cached Files (purgeable and file-backed pages)
Free Memory
Monitor virtual memory swap space: total swap, used swap, free swap, and swap rate.
Monitor macOS memory pressure events: Normal, Warning (pressure on cache/compression), and Critical (active swapping / process termination risk).
Visualize memory distribution as a stacked memory bar and gauge.
Implementation Suggestions
Query Mach VM statistics in Objective-C using host_statistics64(mach_host_self(), HOST_VM_INFO64, ...) with vm_statistics64_data_t.
Retrieve page size via vm_kernel_page_size to calculate exact byte values.
Query swap statistics via sysctlbyname("vm.swapusage", &swap, &len, NULL, 0).
Register a GCD memory pressure dispatch source using dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, DISPATCH_MEMORYPRESSURE_NORMAL | DISPATCH_MEMORYPRESSURE_WARN | DISPATCH_MEMORYPRESSURE_CRITICAL, queue) to receive real-time OS memory pressure state transitions.
### Purpose
Provide comprehensive real-time memory telemetry matching and extending macOS Activity Monitor, breaking down physical RAM into distinct categories, tracking swap memory usage, and monitoring macOS virtual memory pressure levels.
### Priority
**Critical** (Core subsystem telemetry directly affecting system stability and responsiveness)
### Dependencies
- Depends on #1 (Core Application Architecture & Objective-C/SwiftUI Bridging Foundation)
### Scope
- Report total installed physical RAM.
- Break down memory allocation into:
- App Memory (active + internal anonymous pages)
- Wired Memory (kernel and driver locked pages)
- Compressed Memory (pages held in kernel compressor)
- Cached Files (purgeable and file-backed pages)
- Free Memory
- Monitor virtual memory swap space: total swap, used swap, free swap, and swap rate.
- Monitor macOS memory pressure events: Normal, Warning (pressure on cache/compression), and Critical (active swapping / process termination risk).
- Visualize memory distribution as a stacked memory bar and gauge.
### Implementation Suggestions
- Query Mach VM statistics in Objective-C using `host_statistics64(mach_host_self(), HOST_VM_INFO64, ...)` with `vm_statistics64_data_t`.
- Retrieve page size via `vm_kernel_page_size` to calculate exact byte values.
- Query swap statistics via `sysctlbyname("vm.swapusage", &swap, &len, NULL, 0)`.
- Register a GCD memory pressure dispatch source using `dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, DISPATCH_MEMORYPRESSURE_NORMAL | DISPATCH_MEMORYPRESSURE_WARN | DISPATCH_MEMORYPRESSURE_CRITICAL, queue)` to receive real-time OS memory pressure state transitions.
Extracted active, inactive, wired, compressed, and free bytes.
Polled sysctl vm.swapusage for total and used swap bytes.
Polled kern.memorystatus_vm_pressure_level for memory pressure classification.
Unit tested with 100% pass in MMMemoryTests.swift.
Completed in `feat/8-ram-breakdown` and merged into `develop`.
- Implemented `MMMemoryTelemetryProvider` sampling Mach `host_statistics64` (`HOST_VM_INFO64`).
- Extracted active, inactive, wired, compressed, and free bytes.
- Polled sysctl `vm.swapusage` for total and used swap bytes.
- Polled `kern.memorystatus_vm_pressure_level` for memory pressure classification.
- Unit tested with 100% pass in `MMMemoryTests.swift`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Purpose
Provide comprehensive real-time memory telemetry matching and extending macOS Activity Monitor, breaking down physical RAM into distinct categories, tracking swap memory usage, and monitoring macOS virtual memory pressure levels.
Priority
Critical (Core subsystem telemetry directly affecting system stability and responsiveness)
Dependencies
Scope
Implementation Suggestions
host_statistics64(mach_host_self(), HOST_VM_INFO64, ...)withvm_statistics64_data_t.vm_kernel_page_sizeto calculate exact byte values.sysctlbyname("vm.swapusage", &swap, &len, NULL, 0).dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, DISPATCH_MEMORYPRESSURE_NORMAL | DISPATCH_MEMORYPRESSURE_WARN | DISPATCH_MEMORYPRESSURE_CRITICAL, queue)to receive real-time OS memory pressure state transitions.Technical Implementation Plan & Code Solution
1. Memory Subsystem Architecture
To match macOS Activity Monitor, RAM must be divided into:
compressor_page_count).2. Objective-C Provider (
MMMemoryProvider.m)3. Swift UI Integration
4. Edge Cases Handled
DISPATCH_SOURCE_TYPE_MEMORYPRESSUREprovides immediate detection before swapping freezes UI responsiveness.Completed in
feat/8-ram-breakdownand merged intodevelop.MMMemoryTelemetryProvidersampling Machhost_statistics64(HOST_VM_INFO64).vm.swapusagefor total and used swap bytes.kern.memorystatus_vm_pressure_levelfor memory pressure classification.MMMemoryTests.swift.