Skip to content

Commit 4a7ee77

Browse files
committed
* Fixed an issue with the process analyzer and emptying working sets
1 parent adade4f commit 4a7ee77

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

MemPlus/Business/PROCESS/ProcessDetail.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,5 @@ internal class ProcessDetail
2323
/// The current memory usage of the Process in MB
2424
/// </summary>
2525
public string MemoryUsage { get; set; }
26-
/// <summary>
27-
/// The Handle of the process
28-
/// </summary>
29-
internal IntPtr Handle { get; set; }
3026
}
3127
}

MemPlus/Business/UTILS/Utils.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ internal static List<ProcessDetail> GetProcessDetails(LogController logControlle
246246
ProcessName = p.ProcessName,
247247
ProcessLocation = p.MainModule.FileName,
248248
MemoryUsage = (p.WorkingSet64 / (1024 * 1024)).ToString("F2") + " MB",
249-
Handle = p.Handle
250249
};
251250
processDetailsList.Add(pd);
252251
}

MemPlus/Views/Windows/ProcessAnalyzerWindow.xaml.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Diagnostics;
23
using System.Windows;
34
using System.Windows.Input;
45
using MemPlus.Business.GUI;
@@ -152,6 +153,11 @@ private void CopyMenuItem_OnClick(object sender, RoutedEventArgs e)
152153
}
153154
}
154155

156+
/// <summary>
157+
/// Method that is called when the working set of a process should be emptied
158+
/// </summary>
159+
/// <param name="sender">The object that called this method</param>
160+
/// <param name="e">The RoutedEventArgs</param>
155161
private void EmptyWorkingSetMenuItem_OnClick(object sender, RoutedEventArgs e)
156162
{
157163
if (LsvProcessList.SelectedItems.Count == 0) return;
@@ -160,7 +166,8 @@ private void EmptyWorkingSetMenuItem_OnClick(object sender, RoutedEventArgs e)
160166
{
161167
_logController.AddLog(new RamLog("Emptying working set for process: " + detail.ProcessName));
162168
// Empty the working set of the process
163-
NativeMethods.EmptyWorkingSet(detail.Handle);
169+
NativeMethods.EmptyWorkingSet(Process.GetProcessById(detail.ProcessId).Handle);
170+
164171
_logController.AddLog(new RamLog("Successfully emptied working set for process " + detail.ProcessName));
165172
}
166173
catch (Exception ex)

0 commit comments

Comments
 (0)