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 leaks #157

Open
8 tasks
gbuela opened this issue Sep 20, 2017 · 3 comments
Open
8 tasks

memory leaks #157

gbuela opened this issue Sep 20, 2017 · 3 comments

Comments

@gbuela
Copy link

gbuela commented Sep 20, 2017

Description:

I'm getting memory leaks here:

0 libsystem_malloc.dylib malloc_zone_malloc
1 libsystem_malloc.dylib malloc
2 libxml2.2.dylib xmlStrndup
3 libxml2.2.dylib xmlSplitQName
4 libxml2.2.dylib xmlSAX2StartElement
5 libxml2.2.dylib htmlParseStartTag
6 libxml2.2.dylib htmlParseContentInternal
7 libxml2.2.dylib htmlParseDocument
8 libxml2.2.dylib htmlDoRead
9 Kanna specialized libxmlXMLDocument.init(xml:url:encoding:option:)
10 Kanna specialized libxmlHTMLDocument.init(html:url:encoding:option:)
11 Kanna libxmlHTMLDocument.init(html:url:encoding:option:) /Users/.../Pods/Kanna/Sources/Kanna/Kanna.swift:0
12 Kanna libxmlHTMLDocument.__allocating_init(html:url:encoding:option:) /Users/.../Pods/Kanna/Sources/Kanna/Kanna.swift:0
13 Kanna HTML(html:encoding:option:) /Users/.../Pods/Kanna/Sources/Kanna/Kanna.swift:125

Installation method:

  • Carthage
  • [ X] CocoaPods(1.1.0 or later)
  • Swift Package Manager
  • Manually
  • other: ()

Library version:

  • v2.1.1
  • [X ] other: (2.2.1)

Xcode version:

  • 8.1 (Swift 3)
  • 8.1 (Swift 2.3)
  • 7.3.1
  • [X ] other: (9.0 Swift 3.2)
@tid-kijyun
Copy link
Owner

@gbuela

Thanks for letting me know. However I can not reproduce it for now.
I'd like to know more about leak situation.

  1. Does it occur even with simple HTML/XML parsing?
  2. Could you present code to reproduce?
  3. Please let us know if there is additional information.

Thanks

@bfichter
Copy link

I realize this is an old issue at this point, but I am experiencing this as well with 5.2.7. It happens for me after calling htmlDocument.body?.removeChild(childElement).

It seems removeChild doesn't fully cleanup the libxml2 memory. Possibly it should call xmlFreeNode instead of xmlFree?

@tid-kijyun
Copy link
Owner

@bfichter
You're right. Thanks for the helpful advice!

kylehughes added a commit to kylehughes/Fuzi that referenced this issue Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants