{"action":"created","issue":{"url":"https://api.github.com/repos/proxb/PoshRSJob/issues/48","labels_url":"https://api.github.com/repos/proxb/PoshRSJob/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/proxb/PoshRSJob/issues/48/comments","events_url":"https://api.github.com/repos/proxb/PoshRSJob/issues/48/events","html_url":"https://github.com/proxb/PoshRSJob/issues/48","id":115184971,"number":48,"title":"Not Releasing Memory","user":{"login":"MattHodge","id":1966555,"avatar_url":"https://avatars.githubusercontent.com/u/1966555?v=3","gravatar_id":"","url":"https://api.github.com/users/MattHodge","html_url":"https://github.com/MattHodge","followers_url":"https://api.github.com/users/MattHodge/followers","following_url":"https://api.github.com/users/MattHodge/following{/other_user}","gists_url":"https://api.github.com/users/MattHodge/gists{/gist_id}","starred_url":"https://api.github.com/users/MattHodge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MattHodge/subscriptions","organizations_url":"https://api.github.com/users/MattHodge/orgs","repos_url":"https://api.github.com/users/MattHodge/repos","events_url":"https://api.github.com/users/MattHodge/events{/privacy}","received_events_url":"https://api.github.com/users/MattHodge/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/proxb/PoshRSJob/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/proxb/PoshRSJob/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"proxb","id":5827856,"avatar_url":"https://avatars.githubusercontent.com/u/5827856?v=3","gravatar_id":"","url":"https://api.github.com/users/proxb","html_url":"https://github.com/proxb","followers_url":"https://api.github.com/users/proxb/followers","following_url":"https://api.github.com/users/proxb/following{/other_user}","gists_url":"https://api.github.com/users/proxb/gists{/gist_id}","starred_url":"https://api.github.com/users/proxb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/proxb/subscriptions","organizations_url":"https://api.github.com/users/proxb/orgs","repos_url":"https://api.github.com/users/proxb/repos","events_url":"https://api.github.com/users/proxb/events{/privacy}","received_events_url":"https://api.github.com/users/proxb/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-11-05T00:53:37Z","updated_at":"2015-12-09T18:22:53Z","closed_at":null,"body":"Hi Boe,\r\n\r\nGive these the following a try in a new PowerShell window and use task manager to keep an eye on the memory usage:\r\n\r\n```powershell\r\nImport-Module PoshRSJob\r\n\r\n1..100 | Start-RSJob -Name {$_} -ScriptBlock {\r\n  $i = 0 \r\n  while ($i -lt 1000)\r\n  {\r\n    Set-Variable -Name \"var$($i)\" -Value (Get-Service)\r\n    $i++\r\n  }\r\n}\r\n\r\n# Wait for things to finish\r\nGet-RSJob | Wait-RSJob\r\n\r\n# Throw away the jobs\r\nGet-RSJob | Remove-RSJob\r\n```\r\n\r\nYou will notice over 1gb memory usage even though the jobs have been thrown away.\r\n\r\nIf trying to clear the memory using the `[System.GC]::Collect()` command, the usage drops to around 500mb, but then does not go any lower.\r\n\r\nAny ideas how to free the memory up without restarting the powershell process?\r\n\r\nThanks :)"},"comment":{"url":"https://api.github.com/repos/proxb/PoshRSJob/issues/comments/163348502","html_url":"https://github.com/proxb/PoshRSJob/issues/48#issuecomment-163348502","issue_url":"https://api.github.com/repos/proxb/PoshRSJob/issues/48","id":163348502,"user":{"login":"proxb","id":5827856,"avatar_url":"https://avatars.githubusercontent.com/u/5827856?v=3","gravatar_id":"","url":"https://api.github.com/users/proxb","html_url":"https://github.com/proxb","followers_url":"https://api.github.com/users/proxb/followers","following_url":"https://api.github.com/users/proxb/following{/other_user}","gists_url":"https://api.github.com/users/proxb/gists{/gist_id}","starred_url":"https://api.github.com/users/proxb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/proxb/subscriptions","organizations_url":"https://api.github.com/users/proxb/orgs","repos_url":"https://api.github.com/users/proxb/repos","events_url":"https://api.github.com/users/proxb/events{/privacy}","received_events_url":"https://api.github.com/users/proxb/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T18:22:53Z","updated_at":"2015-12-09T18:22:53Z","body":"Just out of curiosity, what version of PowerShell are you running when you get the memory leaks? "}}