[ https://issues.apache.org/jira/browse/APEXMALHAR-2126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15351786#comment-15351786 ]
Vlad Rozov commented on APEXMALHAR-2126: ---------------------------------------- The intention of com.datatorrent.netlet.util.Slice was to avoid memory copy when raw data is received into a buffer and then parsed into messages, not memory allocation/deallocation. Memory for data structures/tuples still needs to be allocated and allocating large buffer may lead to excessive memory usage when a large buffer is allocated, but not fully used. > Suggest: Share Slice Buffer > --------------------------- > > Key: APEXMALHAR-2126 > URL: https://issues.apache.org/jira/browse/APEXMALHAR-2126 > Project: Apache Apex Malhar > Issue Type: Improvement > Reporter: bright chen > > I think the intention of Slice(com.datatorrent.netlet.util.Slice) was to > share the buffer and avoid unnecessary memory allocation/deallocation. But > the intension is not self-explain and lack of method to share the memory. And > the util class org.apache.apex.malhar.lib.utils.serde.SliceUtils also create > new memory and copy the data. > I suggest to implement another class(Say BufferSlice), which > - initialize buffer with relative large buffer > - support append(byte[] data, int offset, int length) > - dynamic reallocated buffer or throw exception when buffer is full ( based > on the management strategy) -- This message was sent by Atlassian JIRA (v6.3.4#6332)