Can we also add some stats around this to track these. ? Discipline around memory release is new concept to Java world.
On Fri, Jul 21, 2017 at 12:59 AM Enrico Olivelli <eolive...@gmail.com> wrote: > Hi, > I have just file this issue > https://github.com/apache/bookkeeper/issues/271 > > After the switch to Netty 4 I noticed this "API change", that is very > important to be documented and/or to be addresses. > > Inside LedgerEntry object we retain a ByteBuf, which is turn is > automatically 'released' only in this cases: > > - getEntry() is called > - getEntryInputStream() is called and the InputStream is closed > - the ByteBuf is manually closed by the client > > The real tricky thing is that if the client calls readEntry and the > Enumeration is not fully processed we are going to leak ByteBufs and so > head/direct memory. > > My proposal: > introduce some "entry reference counting" and ensure that all generated > entries by a LedgerHandler are "disposed" on LedgerHandler.close() and make > sure that when BookKeeper client is closed all of the LedgerHandlers > process their own disposal procedure > > > -- Enrico > -- Sent from iPhone