Community

"Program has stopped working" message appears even though I Dispose of the engine loader

In the past, if I did not dispose of the engine loader, after closing my program, a "<ProgramName.exe> has stopped working" popup would appear.

I started seeing this popup again after I began reusing the engineLoader instance to save time. I dispose of the engineLoader as my program exits (and I've verified that Dispose is called), but I now see this same popup.

Anyone know why I am seeing this popup under these circumstances?

Was this article helpful?

0 out of 1 found this helpful

Comments

3 comments

  • Avatar
    Permanently deleted user

    Hi, 

    As for now, it is hard to say where the issue comes from.  The most popular reason for crashes during Dispose call is that some engine objects may be unreleased to that moment yet. You can read this article in order to prevent this variant.

    If the popup appears further, could you please attach your Engine logs? They can be obtained by the Engine::StartLogging(<filename for logs>) method called after the engine was loaded and before a processing started.

    Also it would be useful if you clarify what ABBYY FineReader Engine build you’re using and send us an example of your code. You can send it to our email SDK_Support@abbyy.com if you want. The build number is at the top right corner of the Developers Help → Introduction page. 

    0
  • Avatar
    Permanently deleted user

     

    I switched on logging, and It seems the issue is due to the engine being released on a different thread from the one that instantiated it:

    6080 :11:30:05.360, 0 ms, FREngine::DeinitializeEngine() Wrong thread! 

    6080 :Engine should be initialized and deinitialized in the same thread

    Is there any way to deinitialize the engine on a separate thread?

    Also, why is it necessary to call DeinitializeEngine() when the process is going away? What exactly is being disposed?

    0
  • Avatar
    Permanently deleted user

    Hi,

    DeinitializeEngine() should be called to unload all FineReader Engine DLLs from the memory. You should do this because DLLs are unmanaged objects, so garbage collector (in languages that have it) doesn’t know when these objects should be released. Therefore you should deinitialize Engine at the same thread where you’ve created it. 

    In the common case just try to perform creating and deinitialization in the main thread. Please see the Samples, they nicely demonstrate how to do it. Default folder for Samples is C:\ProgramData\ABBYY\SDK\11\FineReader Engine\Samples . Note that the ProgramData folder may be hidden.

    If you need to process images in parallel, please use built-in mechanisms for it. You could read more about them in Developer’s Help → Guided Tour → Advanced Techniques  → Parallel Processing.

    If there are some reasons of why you need call DeinitializeEngine() method not in the main thread, you can send us your code or just post main pieces of it there, so that we could help you to find a solution.

    0

Please sign in to leave a comment.