finagle-netty4: better leak detection model
finagle-netty4: better leak detection model

Problem

Netty's leak detection model distinguishes between composite byte
buffers with unpooled offheap components and unpooled off heap byte
buffers. It considers unreleased instances of the former to be leaks
but not so with the latter. This is a problem for finagle protocols
that use netty's decoders (such as http) because despite our pipelines
being set up to copy all data on heap, leaks can be declared after
passing the onheap unpooled buffers through a netty decoder.

Solution

Introduce a composite bytebuffer which is aware of its components
and only allows GC-releasable resource. We also introduce a
LeakDetectingAllocator so that we can produce instances of our new
buffer type.

Result

We bend netty's leak detection to the model we actually want, where
unreleased pooled or direct buffers are leaks and anything unpooled
and onheap is not.

RB_ID=908588

BuoyantIO/twitter-server,twitter/twitter-server,BuoyantIO/twitter-server,BuoyantIO/twitter-server,BuoyantIO/twitter-server,twitter/twitter-server,twitter/twitter-server