{"action":"created","issue":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/4114","repository_url":"https://api.github.com/repos/D-Programming-Language/phobos","labels_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/4114/labels{/name}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/4114/comments","events_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/4114/events","html_url":"https://github.com/D-Programming-Language/phobos/pull/4114","id":143108324,"number":4114,"title":"Avoid brute force fd close() on Linux","user":{"login":"mrkline","id":493463,"avatar_url":"https://avatars.githubusercontent.com/u/493463?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkline","html_url":"https://github.com/mrkline","followers_url":"https://api.github.com/users/mrkline/followers","following_url":"https://api.github.com/users/mrkline/following{/other_user}","gists_url":"https://api.github.com/users/mrkline/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkline/subscriptions","organizations_url":"https://api.github.com/users/mrkline/orgs","repos_url":"https://api.github.com/users/mrkline/repos","events_url":"https://api.github.com/users/mrkline/events{/privacy}","received_events_url":"https://api.github.com/users/mrkline/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":26,"created_at":"2016-03-23T23:48:08Z","updated_at":"2016-04-04T15:21:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/4114","html_url":"https://github.com/D-Programming-Language/phobos/pull/4114","diff_url":"https://github.com/D-Programming-Language/phobos/pull/4114.diff","patch_url":"https://github.com/D-Programming-Language/phobos/pull/4114.patch"},"body":"The current Posix implementation of spawnProcess calls close on every fd from 3 to the max fd count (as gathered by `rlimit()`). Given that the process doesn't have that many descriptors open\r\nin the *vast* majority of cases, this is quite pessimal.\r\n\r\nInstead, check `/proc/self/fd` to see which descriptors are actually open, and close those.\r\nA similar solution is probably possible for BSD and friends."},"comment":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/comments/205346361","html_url":"https://github.com/D-Programming-Language/phobos/pull/4114#issuecomment-205346361","issue_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/4114","id":205346361,"user":{"login":"schveiguy","id":580778,"avatar_url":"https://avatars.githubusercontent.com/u/580778?v=3","gravatar_id":"","url":"https://api.github.com/users/schveiguy","html_url":"https://github.com/schveiguy","followers_url":"https://api.github.com/users/schveiguy/followers","following_url":"https://api.github.com/users/schveiguy/following{/other_user}","gists_url":"https://api.github.com/users/schveiguy/gists{/gist_id}","starred_url":"https://api.github.com/users/schveiguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schveiguy/subscriptions","organizations_url":"https://api.github.com/users/schveiguy/orgs","repos_url":"https://api.github.com/users/schveiguy/repos","events_url":"https://api.github.com/users/schveiguy/events{/privacy}","received_events_url":"https://api.github.com/users/schveiguy/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T15:21:26Z","updated_at":"2016-04-04T15:21:26Z","body":"> I wonder what's causing that. Maybe just standard library setup and teardown.\r\n\r\nI think it's probably caused by:\r\n1. D runtime uses more RAM, so forking is more expensive.\r\n2. D runtime teardown is not as simple as C++ (e.g. GC must deallocate everything).\r\n\r\nruntime setup shouldn't matter, since fork makes a snapshot copy. I think on most unixen, they share COW pages."}}