private void DumpHeap(bool closeOnComplete) { // Are we collecting from a live process? m_args.Process = null; if (m_processList != null) { // Set the process ID var selectedProcess = Processes.SelectedItem as ProcessInfo; if (selectedProcess != null) { m_args.Process = selectedProcess.ProcessID.ToString(); } else { StatusBar.Log("No selection made"); return; } m_args.DoCommand = App.CommandProcessor.HeapSnapshot; } else { m_args.ProcessDumpFile = ProcessDumpTextBox.Text; m_args.DoCommand = App.CommandProcessor.HeapSnapshotFromProcessDump; } var dataFile = DataFileNameTextBox.Text; if (dataFile.Length == 0) { StatusBar.Log("Error: Output data file not specififed."); return; } m_args.DataFile = dataFile; m_args.Freeze = FreezeCheckBox.IsChecked ?? false; m_args.SaveETL = SaveETLCheckBox.IsChecked ?? false; m_args.DumpData = false; // TODO FIX NOW acutlaly use if (!int.TryParse(MaxDumpTextBox.Text, out m_args.MaxDumpCountK)) { StatusBar.LogError("Could not parse MaxDump " + MaxDumpTextBox.Text); return; } if (m_args.MaxDumpCountK >= 10000) { var response = MessageBox.Show("WARNING: you have selected a Max Dump Count larger than 10M objects.\r\n" + "You should only need 100K to do a good job, even at 10M the GUI will be very sluggish.\r\n" + "Consider canceling and picking a smaller value.", "Max Dump Size Too Big", MessageBoxButton.OKCancel); if (response != MessageBoxResult.OK) { StatusBar.Log("Memory collection canceled."); Close(); GuiApp.MainWindow.Focus(); return; } } m_args.NoView = true; m_tookASnapshot = true; m_mainWindow.ExecuteCommand("Dumping GC Heap to " + System.IO.Path.GetFullPath(App.CommandLineArgs.DataFile), m_args.DoCommand, StatusBar, closeOnComplete ? m_continuation : null, delegate { m_mainWindow.StatusBar.Status = StatusBar.Status; if (closeOnComplete) { Close(); } else { StatusBar.Status = "Data in: " + DataFileNameTextBox.Text + ". Press 'Close' or 'Dump GC Heap' to continue."; StatusBar.Beep(); DataFileNameTextBox.Text = CommandProcessor.GetNewFile(DataFileNameTextBox.Text); } }); }