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

[SR-6881] Saving Data from URLSession to disk and NSCache causes double the memory #4260

Open
swift-ci opened this issue Jan 31, 2018 · 1 comment

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-6881
Radar https://bugreport.apple.com/web/?problemID=37082760
Original Reporter Jay18001 (JIRA User)
Type Bug

Attachment: Download

Environment

iOS 11.2, simulator and iPhone X

Xcode 9.2 (9C40b)

macOS 10.12.6 (16G1114)

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug, Leak
Assignee None
Priority Medium

md5: 2870ec4b8f985c3e6bf0c0086b771c40

Issue Description:

When a 10mb file is downloaded using URLSession and written to disk and saved to NSCache the memory goes up by 20mb.

Using the following causes the leak:

do {
     try data.write(to: fileUrl)
} catch {
     print(error)
}

However doing this does not cause the leak:

(data as NSData).write(to: fileUrl, atomically: true)

It happens every time the button is pressed in the attached example project

@belkadan
Copy link

belkadan commented Feb 1, 2018

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
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

2 participants