{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/DotNetty/issues/139","repository_url":"https://api.github.com/repos/Azure/DotNetty","labels_url":"https://api.github.com/repos/Azure/DotNetty/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/Azure/DotNetty/issues/139/comments","events_url":"https://api.github.com/repos/Azure/DotNetty/issues/139/events","html_url":"https://github.com/Azure/DotNetty/issues/139","id":163636105,"number":139,"title":"how to manage IByteBuffer lifetime properly?","user":{"login":"egmkang","id":65175,"avatar_url":"https://avatars.githubusercontent.com/u/65175?v=3","gravatar_id":"","url":"https://api.github.com/users/egmkang","html_url":"https://github.com/egmkang","followers_url":"https://api.github.com/users/egmkang/followers","following_url":"https://api.github.com/users/egmkang/following{/other_user}","gists_url":"https://api.github.com/users/egmkang/gists{/gist_id}","starred_url":"https://api.github.com/users/egmkang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egmkang/subscriptions","organizations_url":"https://api.github.com/users/egmkang/orgs","repos_url":"https://api.github.com/users/egmkang/repos","events_url":"https://api.github.com/users/egmkang/events{/privacy}","received_events_url":"https://api.github.com/users/egmkang/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Azure/DotNetty/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-04T09:20:10Z","updated_at":"2016-07-05T08:49:40Z","closed_at":"2016-07-04T16:44:36Z","body":"I'm using `DotNetty` writing codes to communicate with my c++ server. I read some blogs and realized `IByteBuffer` must be `release`. to confirm this and usage DotNetty in the right way, i have these questions:\r\n\r\n- in my codec, do i need release the IByteBuffer?\r\n```\r\npublic override void ChannelRead(IChannelHandlerContext context, object message)\r\n{\r\n    IByteBuffer buffer = message as IByteBuffer;\r\n    //dost i need release this message after my useage\r\n    buffer.release();\r\n}\r\n```\r\n- i must release an IByteBuffer object allocated by myself?\r\n```\r\nIByteBuffer buffer1 = Unpooled.WrappedBuffer(array);\r\nIByteBuffer buffer2 = UnpooledHeapByteBuffer(PooledByteBufferAllocator.Default, array, array.Length);\r\n```\r\n- interface IByteBuffer  supply many member return an IByteBuffer object. do i need release them?\r\n```\r\nIByteBuffer buff = (message as IByteBuffer).ReadBytes(128);\r\nIByteBuffer slice = (message as IByteBuffer).ReadSlice(128);\r\n```"},"comment":{"url":"https://api.github.com/repos/Azure/DotNetty/issues/comments/230421796","html_url":"https://github.com/Azure/DotNetty/issues/139#issuecomment-230421796","issue_url":"https://api.github.com/repos/Azure/DotNetty/issues/139","id":230421796,"user":{"login":"egmkang","id":65175,"avatar_url":"https://avatars.githubusercontent.com/u/65175?v=3","gravatar_id":"","url":"https://api.github.com/users/egmkang","html_url":"https://github.com/egmkang","followers_url":"https://api.github.com/users/egmkang/followers","following_url":"https://api.github.com/users/egmkang/following{/other_user}","gists_url":"https://api.github.com/users/egmkang/gists{/gist_id}","starred_url":"https://api.github.com/users/egmkang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egmkang/subscriptions","organizations_url":"https://api.github.com/users/egmkang/orgs","repos_url":"https://api.github.com/users/egmkang/repos","events_url":"https://api.github.com/users/egmkang/events{/privacy}","received_events_url":"https://api.github.com/users/egmkang/received_events","type":"User","site_admin":false},"created_at":"2016-07-05T08:49:40Z","updated_at":"2016-07-05T08:49:40Z","body":"@nayato thank you very much. i have read the article carefully. it have solved my No.2 and No.3 problems.  about the first problem. the article said i have release the buffer. \r\nmy question is Netty always Allocate A New Buffer, it won't reuse the buffer object?\r\nfor example, when the buffer contains part of the whole message, i must cache the bytes of buffer netty allocated, and release the buffer, until i can decode one whole message.\r\n\r\nhttps://github.com/Azure/DotNetty/blob/86749e908c1be0800ca43374102b28980519b7ba/src/DotNetty.Transport/Channels/Sockets/AbstractSocketByteChannel.cs#L101"}}
{"actor":{"display_login":"egmkang"}}