-Re: Utf8 byte reuse
Doug Cutting 2012-03-01, 18:37
On 03/01/2012 05:48 AM, Irving, Dave wrote:
> Read D: Reallocates a buffer again, even though weï¿½ve already got a 10
> byte buffer (???)
This is a bug.
> A simple ï¿½fixï¿½ would be to compare the byte length rather than
> this.length before doing a reallocation.
That was the intent.
> The only issue I can see with this though is that you cause a byte of
> the largest utf youï¿½ve read with that instance to stay in memory. If
> thats a concern though, you could always provide a ï¿½limitï¿½ on
> construction of the Utf8 (if the allocated byte goes greater than
> this, drop it and reallocate on the next resize < limit).
That may be a useful feature to add.
> If this something that would be considered for changing if I submit a
> patch / jira?
Yes, please do.