On 04/07/2008 02:05 AM, "이희승 (Trustin Lee) <[EMAIL PROTECTED]>" 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.

- DML

Reply via email to