Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observe method leak #2932

Closed
3 tasks done
juliensagot opened this issue Mar 20, 2024 · 4 comments
Closed
3 tasks done

Observe method leak #2932

juliensagot opened this issue Mar 20, 2024 · 4 comments
Labels
bug Something isn't working due to a bug in the library.

Comments

@juliensagot
Copy link
Contributor

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
@juliensagot juliensagot added the bug Something isn't working due to a bug in the library. label Mar 20, 2024
@mbrandonw
Copy link
Member

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?

@juliensagot
Copy link
Contributor Author

@mbrandonw Done! Unfortunately, I'm experiencing the same leaks:

@mbrandonw
Copy link
Member

Hi @juliensagot, how exactly can I reproduce the problem? I've run the app, increment the counter, and I don't see any leaks:

tmp

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:

https://github.com/pointfreeco/swift-perception/blob/db087559dcc50eedebdc7df6a0fb0c1e188e4229/Sources/Perception/PerceptionRegistrar.swift#L18-L21

@juliensagot
Copy link
Contributor Author

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 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working due to a bug in the library.
Projects
None yet
Development

No branches or pull requests

2 participants