net-mdns icon indicating copy to clipboard operation
net-mdns copied to clipboard

Memory leak in MulticastService

Open ak250995 opened this issue 4 years ago • 1 comments

When created, MulticastService subscribes to static NetworkAddressChangedEvent, and doesn't unsubscribe from it anywhere. Creating MulticastService instances leads to a memory leak.

2020-09-30 16_00_49-Ncr Isip FacadeService – JetBrains dotMemory (Administrator)

ak250995 avatar Nov 06 '20 10:11 ak250995

I believe this causes it. https://github.com/richardschneider/net-mdns/blob/b9f2f8158052568a19d09536179ceaf5cae9b23e/src/MulticastService.cs#L342

It needs to remove the event handler when you dispose the service.

schotime avatar Jun 05 '21 04:06 schotime