Closed meerarno closed 5 months ago
This is a really strange bug it seems. I don't think the implementation is doing anything wrong or bad, I'm actually correctly disposing the client. For some reason, if you run it under net48, some socket related objects stay in memory, even though the socket is closed and the UdpClient deleted.
Anyways, I'm able to reproduce it, which means this is a bug. Changing the Udp implementation to not write to the socket directly seems to fix the issue. I'll push an update soon.
Thanks for letting me know
The latest versions of DnsClient (versions 1.5.0 and above) have a memory leak when used with the full .net framework (version 4.8 for example)
For example: for (int i = 0; i < 1000; i++) { var client = new LookupClient(); var response = await client.QueryAsync("google.com", QueryType.A); }
I think you should not use these higher versions with the full framework, but Visual Studio offers them as an valid update.