Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 1, 2025

Code analysis flagged that InMemoryVectorStore and QdrantVectorStore instances were created but never disposed, causing resource leaks.

Changes

  • Wrapped InMemoryVectorStore creation in Memory and default cases with using statements
  • Wrapped QdrantVectorStore creation with using statement
  • Removed unused vectorStore variable declaration

This follows the pattern already established for RedisVectorStore in commit bb6eda4, ensuring consistent resource management across all vector store types.

// Before
vectorStore = new InMemoryVectorStore();
collection = vectorStore.GetCollection<TKey, TRecord>(name, vectorStoreRecordDefinition);

// After
using (var inMemoryVectorStore = new InMemoryVectorStore())
{
    collection = inMemoryVectorStore.GetCollection<TKey, TRecord>(name, vectorStoreRecordDefinition);
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] WIP to address feedback on memory kernel changes Wrap disposable vector stores in using statements to prevent resource leaks Nov 1, 2025
Copilot AI requested a review from JeffreySu November 1, 2025 05:43
@JeffreySu JeffreySu marked this pull request as ready for review November 1, 2025 07:49
@JeffreySu JeffreySu merged commit 9dbc492 into Developer-MicrosoftMemoryKernel Nov 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants