Github user tejasapatil commented on a diff in the pull request:
https://github.com/apache/spark/pull/17180#discussion_r121021527
--- Diff:
core/src/main/java/org/apache/spark/unsafe/map/BytesToBytesMap.java ---
@@ -358,10 +358,20 @@ public long spill(long numBytes) throws IOException {
return 0L;
}
+ long released = 0L;
+ // longArray will not be used anymore, but may take significant
amount of memory
+ // but never released until the task is complete.
+ if (longArray != null) {
+ released += longArray.memoryBlock().size();
+ freeArray(longArray);
+ longArray = null;
+ }
+ if (released >= numBytes) {
+ return released;
--- End diff --
AFAIK, `spill` is called when other consumers want to allocate in-memory
pages but can't get any memory. If we are able to release ample memory by
free'ing up the `longArray`, then the purpose of `spill` is achieved. Hence the
short circuit.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]