Skip to content

Commit

Permalink
Revert "More"
Browse files Browse the repository at this point in the history
This reverts commit 4cf7a3d.
  • Loading branch information
viirya committed Apr 7, 2024
1 parent 4cf7a3d commit fa5d0b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ protected long doSpilling(
long[] addresses = rowPartition.getRowAddresses();
int[] sizes = rowPartition.getRowSizes();

// We exported the addresses and sizes, reset the row partition
// to release the memory as soon as possible.
rowPartition.reset();

boolean checksumEnabled = checksum != -1;
long currentChecksum = checksumEnabled ? checksum : 0L;

Expand All @@ -199,6 +195,8 @@ protected long doSpilling(
long written = results[0];
checksum = results[1];

rowPartition.reset();

// Update metrics
// Other threads may be updating the metrics at the same time, so we need to synchronize it.
synchronized (writeMetricsToUse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ class RowPartition(initialSize: Int) {

def getNumRows: Int = rowAddresses.size

def getRowAddresses: Array[Long] = rowAddresses.toArray
def getRowAddresses: Array[Long] = {
val array = rowAddresses.toArray
rowAddresses = null
array
}

def getRowSizes: Array[Int] = rowSizes.toArray
def getRowSizes: Array[Int] = {
val array = rowSizes.toArray
rowSizes = null
array
}

def reset(): Unit = {
rowAddresses = new ArrayBuffer[Long](initialSize)
Expand Down

0 comments on commit fa5d0b7

Please sign in to comment.