I am looking for a way to read the current memory usage of a Windows Mobile process.
I started out with accessing the actual process object. To get processId to be passed to Process.GetProcessById(int processId) method I followed this solution.
Unfortunately, .NET CF 3.5 API for System.Diagnostics.Process does not provide any properties / methods to work with the process memory.
There must be a way to do that since tools such as FDCSoft Task Manager display memory usage for each WM process along with much more process data.
There’s nothing in the CF BCL that’s going to give you that information. You’ll need to P/Invoke the Toolhelp Functions and build up a heap list then sum those up to get total process usage. Generally, the call order will look something like this:
CreateToolhelp32Snapshot, ensuring you pass in theTH32CS_SNAPHEAPLISTflagHeap32ListFirstfor the firstHEAPLIST32structureHeap32ListNextfor more structures until it return FALSECallCloseToolhelp32Snapshot`