wireguard-go-awg2-lx/device
Simon Law cd7ac13b86
device: convert runtime.SetFinalizer to AddCleanup (#71)
In PR #66, we tried to address a memory leak by avoiding
runtime.SetFinalizer for autodrainingInboundQueue and
autodrainingOutboundQueue unless there was something to do.

However, when there is work to be done, these finalizers still leak
memory because they’re still holding on to a cyclical reference to q.
This applies to any platform that relies on a bounded device.WaitPool,
like Android and iOS which both declare PreallocatedBuffersPerPool.

This patch converts this logic to runtime.AddCleanup which is designed
to avoid this problem.

Updates tailscale/corp#42776

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2026-08-04 19:18:01 +08:00
..
allowedips.go device: refactor container locking for lock-order clarity 2026-08-04 19:18:01 +08:00
channels.go device: convert runtime.SetFinalizer to AddCleanup (#71) 2026-08-04 19:18:01 +08:00
constants.go Apply Tailscale bind send headroom 2026-05-17 20:36:35 +08:00
cookie.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
device.go device: add peer session state callback 2026-08-04 19:18:01 +08:00
devicestate_string.go device: remove deviceStateNew 2021-02-09 15:39:19 +01:00
indextable.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
ip.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
keypair.go Rename module 2026-05-17 20:09:28 +08:00
logger.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
mobilequirks.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
noise-helpers.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
noise-protocol.go device: fix some lock ordering violations, add a test for a deadlock we hit 2026-08-04 19:18:01 +08:00
noise-types.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
peer.go device: convert runtime.SetFinalizer to AddCleanup (#71) 2026-08-04 19:18:01 +08:00
pools.go device: refactor container locking for lock-order clarity 2026-08-04 19:18:01 +08:00
queueconstants_android.go Rename module 2026-05-17 20:09:28 +08:00
queueconstants_default.go Rename module 2026-05-17 20:09:28 +08:00
queueconstants_ios.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
queueconstants_windows.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
receive.go device: refactor container locking for lock-order clarity 2026-08-04 19:18:01 +08:00
send.go device: refactor container locking for lock-order clarity 2026-08-04 19:18:01 +08:00
sticky_default.go Rename module 2026-05-17 20:09:28 +08:00
sticky_linux.go Rename module 2026-05-17 20:09:28 +08:00
timers.go device: add peer session state callback 2026-08-04 19:18:01 +08:00
tun.go Rename module 2026-05-17 20:09:28 +08:00
uapi.go Rename module 2026-05-17 20:09:28 +08:00