apache / apache/arrow-java

[Java] allocate new buffer code doesn't release extra allocated buffer properly

オープン
#417 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: bug
主要言語
Java
スター
94
フォーク
152
平均マージ
3日 16時間
マージ済み PR(30日)
11

説明

[Class BaseValueVector](https://github.com/apache/arrow/blob/master/java/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java) 's method allocFixedDataAndValidityBufs on line#162 allocates a buffer in power of 2 size. After that, it has a code to release extra buffer. For that, it calculates the extra buffer from allocated size "bufferSize" but in my opinion, it should take original "valueCount" to find the extra buffer size. 

Here, I see a problem in line#162, where its taking "bufferSize" to find the extra allocated bytes. It should be "valueCount\*typeWidth + valueCount/8".

Here is an example for that. Let's take 1000 ints. Then,
valueCount = 1000 ints
typeWidth = 4 bytes
validitiyBufferSize = 125 bytes
valueBufferSize = 4000 bytes
combinedSize(valueBufferSize + validityBufferSize) = 4128 bytes (multiple of 8)
combinedSizeWith2ThePowerSize = 8192 bytes, this will be "bufferSize" at line#152.

With the above calculation, this code should release (combinedSizeWith2ThePowerSize - combinedSize) = 4064 bytes. But, this is not happening.

 

 

**Reporter**: [Hitesh Khamesra](https://issues.apache.org/jira/browse/ARROW-5057)
#### PRs and other links:
- [GitHub Pull Request apache/arrow#4079](https://github.com/apache/arrow/pull/4079)

**Note**: *This issue was originally created as [ARROW-5057](https://issues.apache.org/jira/browse/ARROW-5057). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

java/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java の allocFixedDataAndValidityBufs から始め、特に 162 行目付近の割り当てと追加バッファーの解放を確認してください。1,000 個の int の例についてバッファーサイズの計算を追い、完了した変更によって想定される追加の割り当てが解放されることを確認してください。この issue には PR apache/arrow#4079 がすでにリンクされていることにも注意してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
data, performance
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
20/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。