Template:ComChannelMemoryUsageNote

From emotive
Jump to navigation Jump to search
Exclamation.png Important: Long-time running procedures should note that the OTX runtime will close open ComChannels (see GetComChannel) solely via the CloseComChannel activity! This has an impact on the long-time stability of the runtime environment. To avoid memory leaks, ComChannels should not be opened implicitly, like
ExecuteDiagService(CreateDiagServiceByName(GetComChannel("LL_AirbaUDS","",false), "DiagnServi_ReadDataByIdentECUIdent"), ...);

because the resources cannot be released until the completion of runtime execution. Better use:

ComChannel comChannel = GetComChannel("LL_AirbaUDS","",false);
DiagService diagService = CreateDiagServiceByName(comChannel, "DiagnServi_ReadDataByIdentECUIdent"));
ExecuteDiagService(diagService, ...);
...
CloseComChannel(comChannel);

For the short-dated execution of procedures, this is of minor importance!