add logging for memory.#8844
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds coordinated, periodic memory-usage logging for the iOS tunnel extension, so operators can correlate overall process footprint (Swift/Mach stats) with Go runtime memory behavior (heap/GC/soft limit), helping diagnose memory pressure and potential jetsam events.
Changes:
- Start/stop a Swift-side memory logger (timer + memory-pressure monitoring) tied to the tunnel lifecycle in
PacketTunnelProvider. - Add a Go-side periodic runtime memory logger (
runtime.MemStats+debug.SetMemoryLimitsnapshot) to emit structured memory metrics. - Wire the Go memory logger to the IPC server lifecycle so it only runs while the tunnel IPC server is active.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lantern-core/mobile/mobile.go |
Starts/stops the Go memory logger alongside IPC server start/close. |
lantern-core/mobile/memory_logger.go |
New Go implementation for periodic runtime memory stats logging. |
ios/Tunnel/PacketTunnelProvider.swift |
Adds periodic process memory footprint logging + memory pressure tracking for the tunnel extension. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces comprehensive memory usage logging for the iOS tunnel extension, with coordinated logging from both the Swift (PacketTunnelProvider) and Go (lantern-core) sides. The main goal is to monitor and correlate the Go runtime's memory usage with the overall process footprint, aiding in diagnosing memory pressure and potential jetsam events. The most important changes are:
iOS Swift-side memory logging:
PacketTunnelProvider.swiftthat records detailed process memory statistics and tracks system memory pressure events, starting and stopping with the tunnel lifecycle.Go runtime memory logging:
memory_logger.goto periodically log Go runtime memory stats (heap, stack, GC, soft memory limit, etc.), synchronized with the Swift logger's cadence for easy correlation.StartIPCServerto start the Go-side memory logger when the tunnel starts, andCloseIPCServerto stop it when the tunnel stops, ensuring logs are only collected during the tunnel's active period. [1] [2]