You are here: dtSearch .NET Standard API
> IDisposable Pattern
dtSearch .NET Standard API 2021.02
IDisposable Pattern

Use the IDisposable pattern with dtSearch Engine API objects to prevent memory depletion.

The IDisposable pattern is used to ensure that unmanaged resources are freed quickly when no longer needed. Otherwise, the .NET garbage collector may take a long time to free memory used by potentially large objects such as SearchResults, resulting in memory depletion in long-running applications. In C# code, use a "using" clause with dtSearch Engine API objects, and in other code call Dispose() when you are done with an object. 

The following API objecs implement IDisposable:

  • FileConverter
  • IndexCache
  • IndexJob
  • ListIndexJob
  • SearchFilter
  • SearchJob
  • SearchReportJob
  • SearchResults
  • WordListBuilder
Copyright (c) 1998-2021 dtSearch Corp. All rights reserved.