protected virtual void Dispose(bool disposing) { s_instance = null; if (IsLoaded) { UnsafeNativeMethods.Teardown(); IsLoaded = false; } if (IsParserLoaded) { UnsafeNativeMethods.TeardownParser(); IsParserLoaded = false; } if (IsLanguageClassifierLoaded) { UnsafeNativeMethods.TeardownLanguageClassifier(); IsLanguageClassifierLoaded = false; } if (_DataDirPtr != IntPtr.Zero) { Marshal.FreeHGlobal(_DataDirPtr); _DataDirPtr = IntPtr.Zero; } }
public static LibPostal GetInstance(string dataDir) { return(s_instance ?? (s_instance = new LibPostal(dataDir))); }