On 10 Jun 2011, at 04:48, Tristan Tarrant wrote:
I don't know if I'm actually contributing something here or
just creating noise.
Are these buffers reused over time ? If not, from a GC point of view
it would be better then not to reduce the size of the buffer just to
save a few bytes: it would mean throwing to GC a perfectly valid bit
of memory. Increasing the size is another matter.
If Infinispan is not reusing buffers, why isn't it ?
Actually this is a good point. We're looking at holding on to the buffer size in a
thread-local, but actually creating a new buffer each time.
Somewhere in this thread there was discussion of creating a buffer per thread
(thread-local again) but was determined to be too much of a mem leak (and I agree with
this).
Maybe it makes sense to create a pool of buffers, to be shared? It would certainly save
on gc overhead. But what about the cost of synchronizing access to this buffer pool?
Maybe allocating one large buffer and different threads making use of different ranges
here? Again, the sync could be pretty complex. But concievably lots of benefits though.
Thoughts and opinions?
Cheers
Manik
--
Manik Surtani
manik(a)jboss.org
twitter.com/maniksurtani
Lead, Infinispan
http://www.infinispan.org