Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kecookier committed Dec 6, 2024
1 parent 38dd5a0 commit 057a94d
Showing 1 changed file with 0 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@
*/
package org.apache.gluten.memory.memtarget;

import org.apache.gluten.GlutenConfig;
import org.apache.gluten.GlutenConfig$;

import org.apache.spark.SparkEnv;
import org.apache.spark.memory.SparkMemoryUtil;
import org.apache.spark.sql.internal.SQLConf;
import org.apache.spark.task.TaskResources;
import org.apache.spark.util.SparkResourceUtil;
import org.apache.spark.util.Utils;

public class ThrowOnOomMemoryTarget implements MemoryTarget {
Expand All @@ -36,22 +33,6 @@ public ThrowOnOomMemoryTarget(MemoryTarget target) {
@Override
public long borrow(long size) {
long granted = target.borrow(size);

// if multi-slot and shared mode, retry spill.
if (granted < size
&& SparkResourceUtil.getTaskSlots(SparkEnv.get().conf()) > 1
&& !GlutenConfig.getConf().memoryIsolation()) {
long overUsed =
SparkMemoryUtil.getTaskOffheapMemoryUsage()
- GlutenConfig.getConf().taskOffHeapMemorySize();
if (overUsed > 0 || Math.abs(overUsed) < size) {
long spillSize = size + Math.abs(overUsed);
target.borrow(spillSize);
target.repay(spillSize);
}
granted = target.borrow(size);
}

if (granted >= size) {
return granted;
}
Expand Down

0 comments on commit 057a94d

Please sign in to comment.