[FlexiCapture Engine 11] Logging of unreleased objects in FCEngine 11

  • 573 Views
  • Last Post 05 July 2016
JeffGlass posted this 22 June 2016

The FlexiCapture Engine 11 User Guide says:

You can get the list of not released objects, if you call the IEngine::StartLogging method before deinitialization.

My code (note that Engine and libraryHandle have been initialized, and StartLogging was called):

  CSafePtr<iengine> Engine;
  static HMODULE libraryHandle;
  ...
  Log::log("UnloadFCEngine: begin\n");
  // Create an object that won't be released, hoping to see it mentioned in the log
  IImageLoadingParams* imageLoadingParams;
  CheckResult( Engine->CreateImageLoadingParams(&imageLoadingParams) );
  // Deinitialize FlexiCapture Engine
  typedef HRESULT ( STDAPICALLTYPE* DeinitializeEngineFunc )();
  DeinitializeEngineFunc pDeinitializeEngine =
    ( DeinitializeEngineFunc )GetProcAddress( libraryHandle, "DeinitializeEngine" );
  if( pDeinitializeEngine == 0 || pDeinitializeEngine() != S_OK ) {
    throw CAbbyyException( L"Error while unloading ABBYY FlexiCapture Engine" );
  }
  FreeLibrary( libraryHandle );
  libraryHandle = 0;
  Engine = 0;
  Log::log("UnloadFCEngine: end\n");

The resulting log messages:

06-22-2016 12:09:19 UnloadFCEngine: begin
12:09:19.842, 0 ms,     IEngine::CreateImageLoadingParams( ( IImageLoadingParams ** )0x28fb10 )
06-22-2016 12:09:21 UnloadFCEngine: end

No message about an unreleased ImageLoadingParams object. I know I've seen this work in earlier versions. What am I missing?

thanks/jeff

Anna Falevskaya posted this 05 July 2016

Hi Jeff,

Thank you very much for your attentiveness and for your report!

The Help contains incorrect information, we apologize for the inconvenience. This is expected behavior: the list of not released objects isn't displayed in the log because in environments with GC (.Net, Java) there is no possibility to separate real leaks from objects that are holded by GC, so in such environments this feature gives false information.

In the next release of FCE 11 (FCE 11 R3) we will add the specific method of logging that would allow to detect unreleased objects.

Close