Main Menu

All times are in GMT -8 (DST) :: The time is now 5:27 pm.

Login or Register
Create an account and register your LMI products to gain access to useful resources.

Register Account


Sub Menu

Knowledge Base
Article Data
Article Ref
Date Created
Thu, 9th Aug 2012
Date Modified
Tue, 11th Mar 2014

   Adding and removing processes from the Process Manager


Why is there a high memory usage when adding and removing processes from the Process Manager?


Adding and removing the processes should not be leaking memory. However, when seeing an increase of memory usage, it is recommended to verify that the handles to the HexSight processes are all released properly.

When getting a reference to a COM object (HexSight tool), it is important to use the ReleaseComObject() function on it, or to make sure it is properly deleted (C++) or reassigned to NULL or Nothing (.NET). Otherwise, a handle is maintained for the object, and it will remain alive, even if deleted using the RemoveProcess(). This is usually where the leaking symptoms happen.

In the VBNET version of the LocatorDemo, you can see that the references to the tools are always set to Nothing before the end of the scope, and that the GC (GarbageCollector) is ordered to completely remove any copy from memory. This is another way to do the ReleaseComObject().

        Dim lAcquisition As HSACQUISITIONDEVICELib.HSAcquisitionDevice
        lAcquisition = applicationControl.ProcessManager.Process("Acquisition")         applicationControl.ProcessManager.Execute("Acquisition")         System.Runtime.InteropServices.Marshal.ReleaseComObject(lAcquisition)         lAcquisition = Nothing