{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/3147","repository_url":"https://api.github.com/repos/dotnet/coreclr","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/3147/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/3147/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/3147/events","html_url":"https://github.com/dotnet/coreclr/issues/3147","id":133141110,"number":3147,"title":"Can QueueUserWorkItemCallback be pooled?","user":{"login":"benaadams","id":1142958,"avatar_url":"https://avatars.githubusercontent.com/u/1142958?v=3","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-12T02:16:18Z","updated_at":"2016-02-12T17:30:38Z","closed_at":null,"body":"They don't seem to be particularly exotic consisting of only 3 fields; is fairly local/contained type\r\n```csharp\r\nprivate WaitCallback callback;\r\nprivate ExecutionContext context;\r\nprivate Object state;\r\n```\r\nCould be returned to pool at end of `QueueUserWorkItemCallback::IThreadPoolWorkItem.ExecuteWorkItem`\r\n\r\nFeature high in plaintext allocations (+41MB/s)\r\n\r\n![QueueUserWorkItemCallback](http://aoa.blob.core.windows.net/aspnet/QueueUserWorkItemCallback.png)\r\n\r\nHigher when pipelining"},"comment":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/comments/183421882","html_url":"https://github.com/dotnet/coreclr/issues/3147#issuecomment-183421882","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/3147","id":183421882,"user":{"login":"ericeil","id":7407587,"avatar_url":"https://avatars.githubusercontent.com/u/7407587?v=3","gravatar_id":"","url":"https://api.github.com/users/ericeil","html_url":"https://github.com/ericeil","followers_url":"https://api.github.com/users/ericeil/followers","following_url":"https://api.github.com/users/ericeil/following{/other_user}","gists_url":"https://api.github.com/users/ericeil/gists{/gist_id}","starred_url":"https://api.github.com/users/ericeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericeil/subscriptions","organizations_url":"https://api.github.com/users/ericeil/orgs","repos_url":"https://api.github.com/users/ericeil/repos","events_url":"https://api.github.com/users/ericeil/events{/privacy}","received_events_url":"https://api.github.com/users/ericeil/received_events","type":"User","site_admin":false},"created_at":"2016-02-12T17:30:38Z","updated_at":"2016-02-12T17:30:38Z","body":"I don't think these can be pooled without some changes to the work queue implementation, which does a bunch of crazy lock-free stuff that assumes object identity is a good proxy for work item identity.  If it suddenly became true that a given object may now represent many different workitems, depending on when you observe it, then we'd be likely to have a long tail of subtle issues where we fail to execute work, execute it twice, etc.  \r\n\r\nGetting this to work correctly would be very hard."}}