Copilot commented on code in PR #2108:
URL: https://github.com/apache/auron/pull/2108#discussion_r2963728771
##########
spark-extension/src/main/scala/org/apache/spark/sql/auron/memory/SparkOnHeapSpillManager.scala:
##########
@@ -195,6 +195,10 @@ object SparkOnHeapSpillManager extends Logging {
def current: OnHeapSpillManager = {
val tc = TaskContext.get
- all.getOrElseUpdate(tc.taskAttemptId(), new SparkOnHeapSpillManager(tc))
+ if (tc != null) {
+ all.getOrElseUpdate(tc.taskAttemptId(), new SparkOnHeapSpillManager(tc))
+ } else {
+ OnHeapSpillManager.getDisabledOnHeapSpillManager
+ }
Review Comment:
`OnHeapSpillManager.getDisabledOnHeapSpillManager()` creates a new anonymous
instance on each call (see `auron-core/.../OnHeapSpillManager.java`). Since
`current` may be called repeatedly on the driver (where `TaskContext.get ==
null`), consider caching a single disabled manager instance in
`SparkOnHeapSpillManager` (e.g., a private `val`) and returning that to avoid
unnecessary allocations/GC churn.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]