Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro, mail # user - Utf8 byte[] reuse


Copy link to this message
-
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.

Thanks!

Doug