{"action":"created","issue":{"url":"https://api.github.com/repos/netty/netty/issues/4544","labels_url":"https://api.github.com/repos/netty/netty/issues/4544/labels{/name}","comments_url":"https://api.github.com/repos/netty/netty/issues/4544/comments","events_url":"https://api.github.com/repos/netty/netty/issues/4544/events","html_url":"https://github.com/netty/netty/issues/4544","id":120889419,"number":4544,"title":"Inconsistent pooled memory usage (can lead to OOM)","user":{"login":"slandelle","id":849197,"avatar_url":"https://avatars.githubusercontent.com/u/849197?v=3","gravatar_id":"","url":"https://api.github.com/users/slandelle","html_url":"https://github.com/slandelle","followers_url":"https://api.github.com/users/slandelle/followers","following_url":"https://api.github.com/users/slandelle/following{/other_user}","gists_url":"https://api.github.com/users/slandelle/gists{/gist_id}","starred_url":"https://api.github.com/users/slandelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slandelle/subscriptions","organizations_url":"https://api.github.com/users/slandelle/orgs","repos_url":"https://api.github.com/users/slandelle/repos","events_url":"https://api.github.com/users/slandelle/events{/privacy}","received_events_url":"https://api.github.com/users/slandelle/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars.githubusercontent.com/u/439362?v=3","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"milestone":null,"comments":9,"created_at":"2015-12-07T22:57:54Z","updated_at":"2016-01-05T19:55:48Z","closed_at":"2016-01-05T19:55:48Z","body":"Netty 4.0.33.Final\r\nOSX 10.11.1\r\nHotspot 1.8.0_66\r\n\r\nI have a custom `ChunkedInput` that can get fed externally. I found out that memory usage can be pretty different depending on the queue used between the single producer and the single consumer (the Netty IO thread). Native memory usage can be as low as the initial 16Mb, or skyrocket to several 100Mb, or even crash with OOM.\r\n\r\nPlease check [this pure Netty based test case](https://github.com/slandelle/netty-native-mem-usage).\r\n\r\nNote that I never had any issue with unpooled memory, so this definitively has to do with pooled memory recycling.\r\n\r\nHere's some results I got on my machine (but the ABQ ones can vary):\r\n```\r\ntestFairABQWithPut\r\nTest completed in 75s\r\n>>>Direct buffers count=4 capacity=16Mb used=16Mb\r\n\r\ntestUnfairABQWithPut\r\nTest completed in 69s\r\n>>>Direct buffers count=9 capacity=96Mb used=96Mb\r\n\r\ntestSPSC\r\nTest completed in 39s\r\n>>>Direct buffers count=4 capacity=16Mb used=16Mb\r\n\r\ntestUnfairABQWithOffer\r\nTest completed in 57s\r\n>>>Direct buffers count=4 capacity=16Mb used=16Mb\r\n```\r\n\r\nPlugging a monitoring tool during the run can make the memory usage skyrocket.\r\n\r\nI don't really get how memory usage can grow this way in a SPSC scenario. If this is not an issue, could you please explain?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/netty/netty/issues/comments/169111497","html_url":"https://github.com/netty/netty/issues/4544#issuecomment-169111497","issue_url":"https://api.github.com/repos/netty/netty/issues/4544","id":169111497,"user":{"login":"slandelle","id":849197,"avatar_url":"https://avatars.githubusercontent.com/u/849197?v=3","gravatar_id":"","url":"https://api.github.com/users/slandelle","html_url":"https://github.com/slandelle","followers_url":"https://api.github.com/users/slandelle/followers","following_url":"https://api.github.com/users/slandelle/following{/other_user}","gists_url":"https://api.github.com/users/slandelle/gists{/gist_id}","starred_url":"https://api.github.com/users/slandelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slandelle/subscriptions","organizations_url":"https://api.github.com/users/slandelle/orgs","repos_url":"https://api.github.com/users/slandelle/repos","events_url":"https://api.github.com/users/slandelle/events{/privacy}","received_events_url":"https://api.github.com/users/slandelle/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T19:55:48Z","updated_at":"2016-01-05T19:55:48Z","body":"Thanks a lot!"}}