StringBuilder default constructor in the class library

Roger Riggs Roger.Riggs at
Thu Dec 14 20:08:13 UTC 2017

Hi Hamada ,

Looking at initial sizes (of StringBuilder) would be a useful contribution.

Take a look at for how to contribute.

Regards, Roger

On 12/14/2017 12:03 PM, Hamada Abdelaziz wrote:
> While analyzing GC pressure of a run time, I noticed the top object 
> being a char[], upon a closer inspection, it turns out to be a result 
> of ObjectStreamClass use of StringBuilder, which is constructed with 
> the default size of 16 bytes.  In such case 16 bytes is not a 
> sufficient size, which leads to unnecessary garbage and incurs a 
> performance hit.
> In a high volume situation this leads to high GC pressure, and in 
> turn, non uniform performance.
> It's worthwhile revisiting all uses of StringBuilder default 
> constructor in the class library and adjusting it appropriately.
> Thoughts?

More information about the core-libs-dev mailing list