Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19077#discussion_r166829018
--- Diff:
common/unsafe/src/main/java/org/apache/spark/unsafe/memory/HeapMemoryAllocator.java
---
@@ -46,9 +47,10 @@ private boolean shouldPool(long size) {
@Override
public MemoryBlock allocate(long size) throws OutOfMemoryError {
- if (shouldPool(size)) {
--- End diff --
I think we don't need to create a new method:
```
int numWords = (int) ((size + 7) / 8); // add some overflow check.
int alignedSize = numWords * 8;
if (shouldPool(alignedSize)) {
...
}
long[] array = new long[numWords];
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]