Skip to content

fix: memory growing by gigabytes over days - #117

Merged
henrikogaard merged 1 commit into
mainfrom
fix/autorelease-leak
Oct 26, 2026
Merged

henrikogaard merged 1 commit into
mainfrom
fix/autorelease-leak

Conversation

@henrikogaard

Copy link
Copy Markdown
Owner

Tidegauge 0.6.0 reached a 3.2 GB footprint after five days on one Mac. heap showed ~4.0M NSRunningApplication, ~4.0M NSLock, ~4.2M NSURL, ~7.0M CFString and ~296k CWFRequestParameters objects: the sampler (and the sensor and disk workers) call AppKit/LaunchServices/CoreWLAN from their own threads, which have no autorelease pool, so every autoreleased object returned during a pass was kept forever.

Fix: wrap each sampler pass, each sensor read, and the disk inventory/IO reads in objc2::rc::autoreleasepool.

Verified (release builds side by side, hidden, separate HOME, 5 minutes):

0.6.0 this branch
NSRunningApplication 4,658 and climbing (~930/min) 0
CWFRequestParameters 292 and climbing 2, flat

cargo test and TIDEGAUGE_TEST_LANG=nb cargo test pass.

@henrikogaard
henrikogaard merged commit 349f477 into main Oct 26, 2026
1 check passed
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.

1 participant