[IMPORTANT/REGRESSION]: The uROCOMInit unit allocates memory, thus disabling usage of 3rd party memory managers

Your uROCOMInit unit references ActiveX unit and it has to be listed first. The problem is that referencing ActiveX unit will allocate memory via RTL memory manager. The issue is that ActiveX unit in latest IDEs references SysUtils unit via System.Internal.ExcUtils.

Therefore, listing the uROCOMInit unit as first unit in uses clause will make impossible to use any 3rd party memory managers (such as FastMM, NexusMM, EurekaLog, etc.), as GetHeapStatus.TotalAllocated will be not 0.

Verified in Delphi 11 Alexandria.

Suggestion: remove reference to ActiveX unit from mROCOMInit unit like this:

unit uROCOMInit;

interface

implementation

{$IFDEF MSWINDOWS}

const
  ole32                = 'ole32.dll';
  COINIT_MULTITHREADED = 0;      // OLE calls objects on any thread.

function CoInitializeEx(pvReserved: Pointer; coInit: Longint): HResult; stdcall; external ole32 name 'CoInitializeEx';
procedure CoUninitialize; stdcall;                                               external ole32 name 'CoUninitialize';

initialization
  CoInitializeEx(0, COINIT_MULTITHREADED);
finalization
  CoUninitialize;

{$ENDIF}

end.

Hi,

you you tried to put 3rd party memory managers as 1st unit and uROCOMInit as 2nd one?

I am not a RemObjects user/client. I am just reporting our findings based on remote session with one of our own clients.

I would assume that your suggested workaround may work for simple cases, but fail if the second framework also wants to initialize/use COM.

Anyway, the proposed change should eliminate the issue completely, so why not?

1 Like

Logged as bugs://D19179.

bugs://D19179 was closed as fixed.