semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Disposing skills

Open SergeyMenshykh opened this issue 2 years ago • 0 comments

Motivation and Context

This change is required to fix a memory leak related to not disposed resource used by Skills. The issue may manifest itself any time skills that work with managed and unmanaged resources like files, network, etc... are registered in Kernel and the Kernel is disposed but the Skills aren't.

Description

This PR adds functionality that disposes all Skills registered in Kernel when Kernel.Dispose method is called.

Contribution Checklist

  • [x] The code builds clean without any errors or warnings
  • [x] The PR follows SK Contribution Guidelines (https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
  • [x] The code follows the .NET coding conventions (https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) verified with dotnet format
  • [x] All unit tests pass, and I have added new tests where possible
  • [x] I didn't break anyone :smile:

SergeyMenshykh avatar May 08 '23 16:05 SergeyMenshykh