Closed dieb closed 4 months ago
More context on issue #29
Observed memory leak in Leaks instrument caused by A and AAAA queries.
hostent is internally allocated by ares_parse_a_reply when we pass non-null pointer, and it expects the caller to freehostent(hostent).
Here we pass host=null to avoid the code branch that allocates hostent here. It looks like this is fine since we don't need hostent.
No hostent is allocated, leak count significantly reduced.
For reference, reduced from 2k leaks to 600 leaks, when resolving about ~200 domains (A and AAAA records)
[Describe the steps you took, or will take, to qualify the change - such as adjusting tests and manual testing.]
Need to fix webhook and run CI before merging.
@swift-server-bot test this please
More context on issue #29
Motivation
Observed memory leak in Leaks instrument caused by A and AAAA queries.
Modifications
hostent is internally allocated by ares_parse_a_reply when we pass non-null pointer, and it expects the caller to freehostent(hostent).
Here we pass host=null to avoid the code branch that allocates hostent here. It looks like this is fine since we don't need hostent.
Result
No hostent is allocated, leak count significantly reduced.
For reference, reduced from 2k leaks to 600 leaks, when resolving about ~200 domains (A and AAAA records)
Test Plan
[Describe the steps you took, or will take, to qualify the change - such as adjusting tests and manual testing.]