I'm using the Xcode Leaks to inspect my app and leaks are showing up when using the lib (v0.3.0). Same leaks were showing up before I upgraded (v0.1.3).
Possible explanation for 2) : ares_parse_a_reply will create hostent and fill it out here which then allocates stuff in addrinfo2hostent. It looks like it has the expectation the caller will call freehostent(hostent). Looks like we can pass host=null and and it won't allocate for *host (this worked and leaks are gone PR - #30 ). We aren't using hostent anyways.
Screenshots below.
How my app uses the lib (note: I don't reuse AsyncDNSResolver, it gets collected):
Hi there,
I'm using the Xcode Leaks to inspect my app and leaks are showing up when using the lib (v0.3.0). Same leaks were showing up before I upgraded (v0.1.3).
I noticed two potential sources of leaks: 1) Continuation leaking in
Ares.query
: https://github.com/apple/swift-async-dns-resolver/blob/main/Sources/AsyncDNSResolver/c-ares/DNSResolver_c-ares.swift#L148 2) Hostent is leaking in AQueryReplyParser and AAAAQueryReplyParser and maybe others but I'm only doing A/AAAAPossible explanation for 1): see PR #31
Possible explanation for 2) : ares_parse_a_reply will create hostent and fill it out here which then allocates stuff in addrinfo2hostent. It looks like it has the expectation the caller will call
freehostent(hostent)
. Looks like we can pass host=null and and it won't allocate for *host (this worked and leaks are gone PR - #30 ). We aren't using hostent anyways.Screenshots below.
How my app uses the lib (note: I don't reuse AsyncDNSResolver, it gets collected):
Querying