[ 
https://issues.apache.org/jira/browse/HBASE-18389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16089503#comment-16089503
 ] 

Xiang Li commented on HBASE-18389:
----------------------------------

Had a discussion with Anoop:
{quote}
Ya. As we pass the length also..   May be a mistake at that time.
This param just makes it sure this is the size of an array java object. 
May be if u remove the param, have to better name the API. Maybe 
sizeOfArray(int len)?
{quote}
It came to a conclusion that we open a JIRA and have it be open for everyone to 
comment.

> Remove byte[] from sizeOf() of ClassSize, ClassSize.MemoryLayout and 
> ClassSize.UnsafeLayout
> -------------------------------------------------------------------------------------------
>
>                 Key: HBASE-18389
>                 URL: https://issues.apache.org/jira/browse/HBASE-18389
>             Project: HBase
>          Issue Type: Bug
>          Components: util
>            Reporter: Xiang Li
>            Assignee: Xiang Li
>            Priority: Minor
>
> In ClassSize class and its internal static class, sizeOf() function has 2 
> formal parameters: byte[] b and int len. But the function's internal logic 
> does not use or refer to byte[] b. Could be removed.
> {code:title=hbase-common/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java|borderStyle=solid}
> // Class of ClassSize
> public static long sizeOf(byte[] b, int len) {
>   return memoryLayout.sizeOf(b, len);
> }
> // Class of ClassSize.MemoryLayout
> long sizeOf(byte[] b, int len) {
>   return align(arrayHeaderSize() + len);
> }
> // Class of ClassSize.UnsafeLayout
> long sizeOf(byte[] b, int len) {
>   return align(arrayHeaderSize() + len * 
> UnsafeAccess.theUnsafe.ARRAY_BYTE_INDEX_SCALE);
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to