Observe method leak
Closed this issue ยท 4 comments
Description
Hi folks ๐
It appears that the observe
method is leaking, even when self
is properly weakified inside the trailing closure, unless I'm doing some silly things.
I've attached a sample macOS project where you can easily repro the issue:
TCAPerceptionLeakSampleProject.zip
Checklist
- I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
- If possible, I've reproduced the issue using the
main
branch of this package. - This issue hasn't been addressed in an existing GitHub issue or discussion.
Expected behavior
No response
Actual behavior
No response
Steps to reproduce
- launch the sample project
- attach Instruments using the Leaks template
- press the
Increment
button
The Composable Architecture version information
1.9.2
Destination operating system
14.4 (23E214)
Xcode version information
Version 15.3 (15E204a)
Swift Compiler version information
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
Hi @juliensagot, this most likely will be fixed when this PR of swift-perception is merged.
Could you help us verify this by adding an explicit dependency on swift-perception to your project and pinning it to the explicit-animation
branch?
@mbrandonw Done! Unfortunately, I'm experiencing the same leaks:
Hi @juliensagot, how exactly can I reproduce the problem? I've run the app, increment the counter, and I don't see any leaks:
Also, are you sure you are running the leaks instrument in DEBUG
? Because the object that is showing up in your screenshot, LockIsolated
, is only used in DEBUG
mode:
Oh no, you are right, I was somehow profiling the app in debug modeโฆ
There are indeed no leaks! I'll close the issue, sorry ๐