Dispose ITopic?

Options
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: 64 Solace Employee
    Options

    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