Commit 91eafaf
Change CommandInfoCache to implement IDisposable and clean up the runspace pool (#1335)
* Change helper to implement IDisposable and clean up the runspace pool
The Helper is recreated with every invocation of Invoke-ScriptAnalyzer which essentially resulted in a runspace which was not cleaned up for every invocation.
I saw 100s of runspaces (ia get-runspace) in my session. I also gave the CommandInfoCache it's own runspace pool and implemented IDisposable in it.
Lastly, I've added a test to catch this in the future.
* Remove runspace from helper
It no longer needs to be IDisposable
Implement dispose in cache along suggested guidelines
* Update Tests/Engine/Helper.tests.ps1
Co-Authored-By: Christoph Bergmeister [MVP] <c.bergmeister@gmail.com>
* Update Tests/Engine/Helper.tests.ps1
Co-Authored-By: Christoph Bergmeister [MVP] <c.bergmeister@gmail.com>
* Update Tests/Engine/Helper.tests.ps1
Co-Authored-By: Christoph Bergmeister [MVP] <c.bergmeister@gmail.com>
* update test language
* Update Tests/Engine/Helper.tests.ps1
Co-Authored-By: Christoph Bergmeister [MVP] <c.bergmeister@gmail.com>
* Fix version comparison to just use major number1 parent b9fd7b3 commit 91eafaf
File tree
3 files changed
+35
-10
lines changed- Engine
- Tests/Engine
3 files changed
+35
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
29 | 53 | | |
30 | 54 | | |
31 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 118 | + | |
124 | 119 | | |
125 | 120 | | |
126 | 121 | | |
| |||
309 | 304 | | |
310 | 305 | | |
311 | 306 | | |
312 | | - | |
313 | 307 | | |
314 | 308 | | |
315 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
29 | 36 | | |
0 commit comments