Applies to:
PcVue all VBA versions. Related articles: KB721 |
||
|
||
Summary:
This article explains the handle (and memory) leakage due to the MULTIMEDIA instruction in SCADA BASIC. Note that there is another workaround which is to increase the number of pre-allocated threads in the Thread Pool. See more details in the article KB721. This workaround is available in the following PcVue versions. 10.0 sp1 update (10.0.16061) |
||
|
||
Solution:
The handle leakage when using the MULTIMEDIA instruction is not in any way related to the sound card or its driver, nor to the version of Microsoft Media Player. Rather. It occurs when a PcVue project takes up more than 100 processing threads in Windows. In that situation we have noted that the deletion of a thread, which PcVue delegates to Windows, does not work correctly. It fails to free all the associated handles, which causes handles and memory not to be released and therefore handle leakage. To avoid this problem from now on (PcVue 8.10 SP7, 8.2 SP2, 9.0 SP1 and 10.0), PcVue internally manages a pool of available (free) threads. When PcVue needs a thread it checks this pool and (re-)uses any that are available, otherwise it creates a new thread. Then when the thread is no longer required, instead of deleting it, PcVue returns it to the pool. In this way, handles are no longer blocked by failure to release memory. However the MULTIMEDIA instruction, whose functioning PcVue delegates to Windows, bypasses this housekeeping of threads. Instead of allocating a thread from a pool of available threads and releasing it back there when it is no longer required, the MULTIMEDIA instruction creates and destroys threads directly. So if one has more than 100 threads in use by PcVue, the memory leakage occurs. A possible work-around for that is to use an external multimedia player of the VLC type and to run it via the SCADA Basic instruction APPLICATION. This bypass allows you to run the VLC player each time to read the required sound file and close it again. To make the starting of the VLC player as transparent as possible for the user, its configuration of settings must be as follows:
|
||
|
||
|
Created on: 02 Sep 2011 Last update: 13 May 2024