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

Memory leak from RequestInterceptor.swift file #3766

Open
1 task done
thinhnguyenext opened this issue Aug 24, 2023 · 2 comments
Open
1 task done

Memory leak from RequestInterceptor.swift file #3766

thinhnguyenext opened this issue Aug 24, 2023 · 2 comments
Assignees

Comments

@thinhnguyenext
Copy link

thinhnguyenext commented Aug 24, 2023

What did you do?

I utilized the leak instrument and detected the memory leak originating from the function adapt in the file RequestInterceptor.swift. In fact, this function failed to add a weak reference in its closure.

image
image

What did you expect to happen?

I expected to add weak or unowned into the adapt function's closure, as this would prevent the memory leak from occurring.

What happened instead?

It still retained the reference that caused the memory leak.

Alamofire Environment

Alamofire Version: 5.7.1
Dependency Manager: SPM
Xcode Version: 14.3.1 (14E300c)
Swift Version: 5
Platform(s) Running Alamofire: iOS Simulator
macOS Version Running Xcode: 13.5.1 Ventura

@jshier
Copy link
Contributor

jshier commented Aug 24, 2023

Can you provide an example project that reproduces this leak? There really shouldn't be a leak here, as all of the captures should be released once the nested adapt calls are complete.

@kittisak-phetrungnapha
Copy link
Contributor

@thinhnguyenext I add memory leak test function and apply it to InterceptorTests. It turn out that no memory leak has been found.
More detail: #3859

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants