Engine Outproc Server not closed

  • 42 Views
  • Last Post 10 October 2017
Angelo posted this 29 September 2017

Hello,

I'm using finereader engine loading it using the OutprocLoader because I need to perform parallel processing of multiple files.

I've noticed that after processing my files an istance of ABBYY FineReader Engine Outproc Server remains appended between background processes shown in task manager. This happens every time I use the engine using OutprocLoader. So I end up with serveral istances of ABBYY FineReader Engine Outproc Server shown between background processes.

All instances appears to be zombie processes and consume between 2 and 3 Mb of memory.

Following is an example call which produce the issue described which I set up to retrieve supported languages.

private async void LoadOCRLanguages()
        {            try
            {
                FREngine.IEngineLoader engineLoader = null;
                try
                {
                    engineLoader = new FREngine.OutprocLoader();

                    IEngine engine = null;
                    engine = engineLoader.GetEngineObject(_ApplicationContext.ABBYY_LICENSE);

                    try
                    {
                        if (!String.IsNullOrEmpty(""))
                        {
                            engine.LoadPredefinedProfile("");
                        }
                    }
                    catch (Exception ex) { }

                    // use current culture to get a FREngine.MessagesLanguageEnum value
                    engine.MessagesLanguage = AbbyFREngineHelper.GetAbbyyLanguageEnum(_ApplicationContext.CurrentCulture);

                    Languages = new List<OCRLanguage>();
                    foreach (FREngine.PredefinedLanguage lang in engine.AvailablePredefinedLanguages)
                    {
                        if (lang.LanguageCategory == FREngine.LanguageCategoryEnum.LC_CoreLanguage)
                        {
                            Languages.Add(new OCRLanguage(lang.ExternalName, lang.InternalName));
                        }
                    }
                    Languages = Languages.OrderBy(v => v.Name).ToList();

                    await Dispatcher.BeginInvoke((Action)(() =>
                    {
                        // update languages list
                        icLanguages.ItemsSource = Languages;
                        icLanguages.UpdateLayout();
                        cbIsSelectd_CheckedChanged(this, new RoutedEventArgs());
                    }));
                }
                catch (Exception ex)
                {
                    Dispatcher.BeginInvoke((Action)(() =>
                    {
                        dpAutoProcessingOptions.Visibility = Visibility.Collapsed;
                    }));
                }
                finally
                {
                    if (engineLoader != null)
                    {
                        engineLoader.ExplicitlyUnload();
                        engineLoader = null;
                        GC.Collect();
                        GC.WaitForPendingFinalizers();
                    }
                }
            }
            catch (Exception ex) { }
}

 

Nikolay Krivchanskiy posted this 10 October 2017

Hi Angelo,

Please try removing the additional try-catch block around engineLoader first initialization with null and move the initialization itself into the inner try block. This should solve the issue you are having. 

If suggested solution will not solve the issue you are having, please send us following information to SDK_Support@abbyy.com:

1. Your license number.

2. The minimal project, that reproduces such behavior and instructions on how to run it.

Close