mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David M. Lloyd" <david.ll...@redhat.com>
Subject Re: Interesting direct buffer vs heap buffer micro benchmark
Date Mon, 07 Apr 2008 13:22:17 GMT
On 04/07/2008 02:05 AM, "이희승 (Trustin Lee) <trustin@gmail.com>" wrote:
> We could create a big read buffer and fire a messageReceived event with
> its sliced part, but we still have an issue with figuring out what part
> of the read buffer is being referenced by user.  We can be notified when
> the slice is garbage collected using PhantomReference, but its
> performance is poor according to my test.  Of course, again, we can ask
> a user to notify the I/O processor when he or she doesn't need it
> anymore, but it's inconvenient and error-prone.

Trustin, what if you only allocate large buffers, and then hand out slices 
to it?  Rather than using PhantomReferences to track the each slice, you 
could track the original buffer itself.  Once the original buffer is no 
longer referenced, you could then create new slices and hand them out.


View raw message