PIG-5385: Skip calling extra gc() before spilling large bag when unnecessary (knoguchi)
git-svn-id: https://svn.apache.org/repos/asf/pig/trunk@1862506 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index 2922cdc..56f4a4c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -26,6 +26,8 @@
IMPROVEMENTS
+PIG-5385: Skip calling extra gc() before spilling large bag when unnecessary (knoguchi)
+
PIG-5389: Passing null to REPLACE udf preventing JIT optimization (knoguchi)
PIG-5382: Log the name when POStore fails on write (knoguchi)
diff --git a/src/org/apache/pig/impl/util/SpillableMemoryManager.java b/src/org/apache/pig/impl/util/SpillableMemoryManager.java
index 2a4b0aa..5e613dc 100644
--- a/src/org/apache/pig/impl/util/SpillableMemoryManager.java
+++ b/src/org/apache/pig/impl/util/SpillableMemoryManager.java
@@ -293,7 +293,8 @@
// Do not invoke extraGC for GroupingSpillable. Its size will always exceed
// extraGCSpillSizeThreshold and the data is always strong referenced.
if( !extraGCCalled && extraGCSpillSizeThreshold != 0
- && toBeFreed > extraGCSpillSizeThreshold && !isGroupingSpillable) {
+ && toBeFreed > extraGCSpillSizeThreshold && !isGroupingSpillable
+ && n.getType().equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED)) {
log.debug("Single spillable has size " + toBeFreed + "bytes. Calling extra gc()");
// this extra assignment to null is needed so that gc can free the
// spillable if nothing else is pointing at it