derfeus Posted March 13, 2007 Report Share Posted March 13, 2007 I'm new to PowerGadgets and it looks useful to me so I thought I would write a simple script to display the process that is consuming the most memory. This is the script I used: (Get-WmiObject win32_process | Sort-Object -property ws | Select-Object -last 1).ProcessName and the second section shows the Working Set for said memory hog: (((Get-WmiObject win32_process | Sort-Object -property ws | Select-Object -last 1).ws)/1024)/1024 I found it a little disconcerting where "PowerGadgets.Presenter.exe" kept being listed as the process with the highest Working Set. It doesn't seem to matter how simple the script is, or the gauge type, the Presenter process consistently consumes 40+ Megs of memory. I'm wondering if this is particular to my system or if others have noticed the same? Any ideas? Cheers... -Fred. Quote Link to comment Share on other sites More sharing options...
JuanC Posted March 13, 2007 Report Share Posted March 13, 2007 Most of the PowerGadgets components including the Presenter is written on .NET, so to compare the working set numbers I wrote the following tests: 1) Empty .NET WinForm app with no extra code = 25MB2) .NET WinForm app connected to a SQL database = 32MB3) .NET WinForm app able to host PowerShell = 31MB4) .NET WinForm app using a chart: WorkingSet = 32MB5) .NET WinForm app using a chart and connected to a SQL database = 39MB6) .NET WinForm app using a chart and able to host PowerShell = 39MB Note that in 1, 2 and 3 we are not using any of our code so it seems that a .NET Windows Form app with almost any useful functionality will get to use 32MB workingset rather quickly. I do not know which percent of this working set may be reclaimed if the OS is low on memory. From 4, 5 and 6 you can see that adding a graphical component (chart, gauge, etc.) will add about 7MB to the required working set which is consistent with the impact of connecting to a database or hosting powershell. Code used for testing extra functionality Connect to databaseSqlConnection sqlConn = new SqlConnection("server=serverName;database=dbName;Trusted_Connection=true");sqlConn.Open(); Host PowerShellobject obj = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(); Using a ChartChart chart = new Chart(); One of the things we do when you create powergadgets from powershell is that we reuse the presenter process for multiple gadgets. This means that if do out-chart twice you will not end up with 2 Presenter processes but instead the impact of the second chart should be quite small. This technique is not used when you create PGF files and double click them but it is something we are actively investigating. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.