🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

Dispose ITopic?

radekm
radekm Member Posts: 23

Hi,
when using Solace from C# / F# I found out that ITopic is IDisposable. But in the tutorials (eg. https://solace.com/samples/solace-samples-dotnet/publish-subscribe/) the topics are not disposed.

So should I dispose them or it's not necessary and not disposing won't create resource / memory leak?

Thanks

Comments

  • Ragnar
    Ragnar Member, Employee Posts: 67 Solace Employee

    Hi,
    IDisposable objects more efficiently release unmanaged memory when Dispose() is called. This guarantees memory is returned to the heap as soon as possible. That said, the Solace C# API will call Dispose() on your behalf if you allow the object to be garbage collected. There won't be a resource or memory leak.

    Hope that helps.
    Ragnar