Hello,
I am quite new user of Lucene, and I was going through the source code trying 
to understand some parts of the implementation.

I was wondering if it would be possible to use pooling inside RAMFile for the 
byte arrays that get allocated via the NewBuffer method (especially since the 
BUFFER_SIZE seems to be fixed as 1024 in RAMOutputStream), and if not what is 
the exact reason? Is it because of thread safety, since lots of 
(publicly-facing) APIs are accessing RAMFile (and potentially allocating new 
buffers) and these could be called by arbitrary threads, which would require 
synchronization which would be really expensive?

By the way, I understand that the NewBuffer is virtual, so a subclass who is 
overriding this can allocate buffers from a custom solution (i.e. pooling), but 
I am mostly wondering what is the reasoning for the base implementation 
provided by Lucene.

Many thanks,
Pantazis

Reply via email to