Re: Expected behavior of StringUtils.estimateMemoryUsage() ?

2016-09-20 Thread Matt Ryan
I created OAK-4830 for this and submitted a patch to the ticket. Thanks! On Tue, Sep 20, 2016 at 1:15 AM, Marcel Reutegger wrote: > On 19/09/16 16:08, Matt Ryan wrote: > >> What about for null though? Currently this method will throw a null >> pointer exception if a null

Re: Expected behavior of StringUtils.estimateMemoryUsage() ?

2016-09-20 Thread Marcel Reutegger
On 19/09/16 16:08, Matt Ryan wrote: What about for null though? Currently this method will throw a null pointer exception if a null string is passed in, which to me seems suboptimal. I agree, this can be improved. I guess so far we just didn't use it with null values. Can you please create an

Re: Expected behavior of StringUtils.estimateMemoryUsage() ?

2016-09-19 Thread Matt Ryan
Thanks Marcel, that's what I thought. What about for null though? Currently this method will throw a null pointer exception if a null string is passed in, which to me seems suboptimal. On Mon, Sep 19, 2016 at 1:30 AM, Marcel Reutegger wrote: > Hi Matt, > > 48 bytes is the

Re: Expected behavior of StringUtils.estimateMemoryUsage() ?

2016-09-19 Thread Marcel Reutegger
Hi Matt, 48 bytes is the shallow size of String object with a 64 Bit Oracle 7 JVM. In this version the String class also keeps offset and length fields, which means the estimate is rather conservative and slightly higher than what is e.g. needed for Oracle's Java 8. The latter only keeps a

Expected behavior of StringUtils.estimateMemoryUsage() ?

2016-09-16 Thread Matt Ryan
Hi, I'm creating some unit tests for StringUtils.estimateMemoryUsage() in oak-commons, and in doing so I noticed that it returns a value of 48 for an empty string. Is this expected? >From a naive point of view it would seem to me that a null string should return 0, and likewise an empty string,