views:

121

answers:

1

Given an application that maintains a singleton instance of a Runspace object (from System.Management.Automation.Runspaces) for the lifetime of the application, what are the potential side effects of failing to dispose of the Runspace before the application is terminated?

The design rationale I have been presented with is that memory/handle leaks are a non-issue in this case because the process termination forces all of those resources to be freed anyway, and the singleton has the same lifetime as the application. Are there other considerations that are ignored by that design?

A: 

My understanding is as yours - since PowerShell is managed code, the.NET framework should clean up after you quit.

Thomas Lee