Gap Buffer based AbstractStringBuilder implementation

Jesús Viñuales serverperformance at
Sun Nov 22 15:12:19 UTC 2009

> There is a security issue there. When multiple threads are involved, it 
> is possible (though not necessily easy) to create a mutable String if 
> the backing char[] is shared.
> Tom Hawtin

True. I worked in a buffer-sharing / copy-on-write optimization one year
ago, and the main issue was breaking the Java lang specs regarding the
inmutability of threads, surely only a issue in theory, but it is a

Nevertheless, the gaining is not clear in modern systems / hotspot / Oss,
because can be garbage collection issued and memory leaks... and in fact
that optimization was there in JDK 1.4 but it was removed in 1.5 because of
that problem (see

But... I would love it working!!!!


More information about the core-libs-dev mailing list