Title: Possible Memory Leak in Foreach -Parallel, version 7.rc1 · Issue #11478 · PowerShell/PowerShell · GitHub
Open Graph Title: Possible Memory Leak in Foreach -Parallel, version 7.rc1 · Issue #11478 · PowerShell/PowerShell
X Title: Possible Memory Leak in Foreach -Parallel, version 7.rc1 · Issue #11478 · PowerShell/PowerShell
Description: Steps to reproduce $messageids | ForEach-Object -Parallel {$mid = $_; $using:log | ? messageid -eq $mid | Sort-Object ExactTimeStamp | Select-Object -first 1} | Export-Csv mtl_midunique.csv -Encoding utf8 -NoTypeInformation $log held ~70...
Open Graph Description: Steps to reproduce $messageids | ForEach-Object -Parallel {$mid = $_; $using:log | ? messageid -eq $mid | Sort-Object ExactTimeStamp | Select-Object -first 1} | Export-Csv mtl_midunique.csv -Encodi...
X Description: Steps to reproduce $messageids | ForEach-Object -Parallel {$mid = $_; $using:log | ? messageid -eq $mid | Sort-Object ExactTimeStamp | Select-Object -first 1} | Export-Csv mtl_midunique.csv -Encodi...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/11478
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Possible Memory Leak in Foreach -Parallel, version 7.rc1","articleBody":"# Steps to reproduce\r\n\r\n```powershell\r\n$messageids | ForEach-Object -Parallel {$mid = $_; $using:log | \r\n ? messageid -eq $mid | \r\n Sort-Object ExactTimeStamp | \r\n Select-Object -first 1} | \r\n Export-Csv mtl_midunique.csv -Encoding utf8 -NoTypeInformation\r\n```\r\n\r\n$log held ~70000 lines imported from a csv holding the export of get-messagetrackinglog, $messageids had ~60000 lines imported from a csv, holding unique messageids\r\n\"ExactTimeStamp\" was build from the TimeStamp property, format 'yyyyMMddHHmmssfff'\r\n\r\n# Expected behavior\r\n\r\nquicker iteration through the date than single threaded, steady memory usage\r\n\r\n# Actual behavior\r\n\r\nmemory usage of the process building up to several GBs, slowing down the iteration to much less than this single threaded code:\r\n```powershell\r\n &{foreach ($mid in $messageids) {&{foreach ($entry in $log) {if ($entry.messageid -eq $mid) {$entry}}} | \r\n Sort-Object ExactTimeStamp | \r\n Select-Object -first 1}} | \r\n Export-Csv mtl_midunique.csv -Encoding utf8 -NoTypeInformation\r\n```\r\n\r\n# Environment data\r\n\r\nName Value\r\n---- -----\r\nPSVersion 7.0.0-rc.1\r\nPSEdition Core\r\nGitCommitId 7.0.0-rc.1\r\nOS Microsoft Windows 10.0.18363\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0","author":{"url":"https://github.com/OtterKring","@type":"Person","name":"OtterKring"},"datePublished":"2020-01-03T10:10:34Z","url":"https://github.com/PowerShell/PowerShell/issues/11478"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d433769a-60d8-39a0-dd9a-bdb38e76f116 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD16:2C6DBB:7132B5:9C307C:6AFDEFEC |
| html-safe-nonce | 010bad0b9fc0b18e96548c3713ba4d8cbed8c08772e1c7d1b020bcc10b358423 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDE2OjJDNkRCQjo3MTMyQjU6OUMzMDdDOjZBRkRFRkVDIiwidmlzaXRvcl9pZCI6Ijc4MjkxMzczNzU2MTA0MDA3NDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4e5171b6857b289e65da6feffe81d18b362203ea8655d6b3a50a3f392c9e7117 |
| hovercard-subject-tag | issue:544929576 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/11478/issue_layout |
| twitter:image | https://opengraph.githubassets.com/da49d7a932d273c12ea365054db788e64b05bf6a294b5767a2cd9f2a5473c425/PowerShell/PowerShell/issues/11478 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/da49d7a932d273c12ea365054db788e64b05bf6a294b5767a2cd9f2a5473c425/PowerShell/PowerShell/issues/11478 |
| og:image:alt | Steps to reproduce $messageids | ForEach-Object -Parallel {$mid = $_; $using:log | ? messageid -eq $mid | Sort-Object ExactTimeStamp | Select-Object -first 1} | Export-Csv mtl_midunique.csv -Encodi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | OtterKring |
| hostname | github.com |
| expected-hostname | github.com |
| None | dd812ec581ecac95855f5ec917ef9827506c39a9da1443f43ddb4179a46471eb |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32ac708bac264dafdc28e10ff49b4d137f0c34a7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width