Skip to content

add logging for memory.#8844

Merged
jigar-f merged 2 commits into
mainfrom
jigar/mem-logging
Jun 8, 2026
Merged

add logging for memory.#8844
jigar-f merged 2 commits into
mainfrom
jigar/mem-logging

Conversation

@jigar-f

@jigar-f jigar-f commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

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:

  • Added a periodic memory logger to PacketTunnelProvider.swift that records detailed process memory statistics and tracks system memory pressure events, starting and stopping with the tunnel lifecycle.

Go runtime memory logging:

  • Introduced memory_logger.go to periodically log Go runtime memory stats (heap, stack, GC, soft memory limit, etc.), synchronized with the Swift logger's cadence for easy correlation.
  • Updated StartIPCServer to start the Go-side memory logger when the tunnel starts, and CloseIPCServer to stop it when the tunnel stops, ensuring logs are only collected during the tunnel's active period. [1] [2]

Copilot AI review requested due to automatic review settings June 8, 2026 13:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread ios/Tunnel/PacketTunnelProvider.swift
Comment thread ios/Tunnel/PacketTunnelProvider.swift Outdated
@jigar-f jigar-f merged commit e737ad6 into main Jun 8, 2026
9 checks passed
@jigar-f jigar-f deleted the jigar/mem-logging branch June 8, 2026 15:27
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.

2 participants