Github user andrewor14 commented on a diff in the pull request: https://github.com/apache/spark/pull/1499#discussion_r15324369 --- Diff: core/src/main/scala/org/apache/spark/util/collection/ExternalAppendOnlyMap.scala --- @@ -120,8 +124,10 @@ class ExternalAppendOnlyMap[K, V, C]( val update: (Boolean, C) => C = (hadVal, oldVal) => { if (hadVal) mergeValue(oldVal, value) else createCombiner(value) } - if (numPairsInMemory > trackMemoryThreshold && currentMap.atGrowThreshold) { - val mapSize = currentMap.estimateSize() + if (elementsRead > trackMemoryThreshold && elementsRead % 32 == 0 && + currentMap.estimateSize() >= myMemoryThreshold) --- End diff -- Did you mean the following: ``` if (elementsRead > trackMemoryThreshold && (elementsRead % 32 == 0 || currentMap.estimateSize() > myMemoryThreshold) ``` Otherwise say if the 33rd element was huge and we already went past our current memory threshold, we will have to wait for another 31 elements before we find a new threshold.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---