Kanna
Kanna copied to clipboard
memory leaks
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)
@gbuela
Thanks for letting me know. However I can not reproduce it for now. I'd like to know more about leak situation.
- Does it occur even with simple HTML/XML parsing?
- Could you present code to reproduce?
- Please let us know if there is additional information.
Thanks
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
?
@bfichter You're right. Thanks for the helpful advice!