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-11144] XMLDocument or XMLElement leaks memory on Linux #3992

Open
swift-ci opened this issue Jul 16, 2019 · 0 comments
Open

[SR-11144] XMLDocument or XMLElement leaks memory on Linux #3992

swift-ci opened this issue Jul 16, 2019 · 0 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-11144
Radar None
Original Reporter chriseidhof (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: c140418a6401f05f9397c5dd7cec846c

Issue Description:

We found that using XMLElement leaks memory under Linux. Here's a simple test program that just parses a document and prints the number of child elements, and running this under Linux, we can see the memory increase with each iteration:

import Foundation

let sample = """
<?xml version="1.0" encoding="UTF-8"?>
<subscription>
<plan_code>monthly-test</plan_code>
<currency>USD</currency>
<account>
<account_code>241A52B6-CE23-4B6A-90B7-52710F3E6312</account_code>
<email>hello@test.nl</email>
<billing_info>
<token_id>O_zV7-8FNW6gYR0tXqrxjA</token_id>
</billing_info>
</account>
</subscription>
"""

let data = sample.data(using: .utf8)!

for _ in 0..<10_000 {
    guard let x: XMLElement = try XMLDocument(data: data, options: []).rootElement() else {
        fatalError()
    }
    print(x.children!.count)
}
@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

1 participant