This is an automated email from the ASF dual-hosted git repository.

mboehm7 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/master by this push:
     new 1cf7bb5  [SYSTEMDS-2594] Fix bufferpool leak in mvvar instructions, 
part 2
1cf7bb5 is described below

commit 1cf7bb54cc86472ec93f9b4bdf89bbece94e15b3
Author: Matthias Boehm <[email protected]>
AuthorDate: Sat Aug 1 14:10:58 2020 +0200

    [SYSTEMDS-2594] Fix bufferpool leak in mvvar instructions, part 2
    
    This additional patch fixes edge cases of the variable cleanup in mvvar
    instructions: (1) for lists of matrices/frames, and (2) scenarios where
    the src and target are the same object.
---
 .../sysds/runtime/instructions/cp/VariableCPInstruction.java      | 8 +++++---
 src/test/java/org/apache/sysds/test/AutomatedTestBase.java        | 2 ++
 src/test/java/org/apache/sysds/test/applications/GLMTest.java     | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/sysds/runtime/instructions/cp/VariableCPInstruction.java
 
b/src/main/java/org/apache/sysds/runtime/instructions/cp/VariableCPInstruction.java
index 0e2b8ad..6cc83a0 100644
--- 
a/src/main/java/org/apache/sysds/runtime/instructions/cp/VariableCPInstruction.java
+++ 
b/src/main/java/org/apache/sysds/runtime/instructions/cp/VariableCPInstruction.java
@@ -682,9 +682,11 @@ public class VariableCPInstruction extends CPInstruction 
implements LineageTrace
                        
                        // remove existing variable bound to target name and
                        // cleanup matrix/frame/list data if necessary
-                       Data tgt = ec.removeVariable(getInput2().getName());
-                       if( tgt != null)
-                               ec.cleanupDataObject(tgt);
+                       if( srcData.getDataType().isMatrix() || 
srcData.getDataType().isFrame() ) {
+                               Data tgtData = 
ec.removeVariable(getInput2().getName());
+                               if( tgtData != null && srcData != tgtData )
+                                       ec.cleanupDataObject(tgtData);
+                       }
                        
                        // do the actual move
                        ec.setVariable(getInput2().getName(), srcData);
diff --git a/src/test/java/org/apache/sysds/test/AutomatedTestBase.java 
b/src/test/java/org/apache/sysds/test/AutomatedTestBase.java
index 9cee894..4647efd 100644
--- a/src/test/java/org/apache/sysds/test/AutomatedTestBase.java
+++ b/src/test/java/org/apache/sysds/test/AutomatedTestBase.java
@@ -1196,6 +1196,8 @@ public abstract class AutomatedTestBase {
                                fail("expected exception which has not been 
raised: " + expectedException);
                }
                catch(Exception e) {
+                       if( !outputBuffering )
+                               e.printStackTrace();
                        if(errMessage != null && !errMessage.equals("")) {
                                boolean result = 
rCompareException(exceptionExpected, errMessage, e, false);
                                if(exceptionExpected && !result) {
diff --git a/src/test/java/org/apache/sysds/test/applications/GLMTest.java 
b/src/test/java/org/apache/sysds/test/applications/GLMTest.java
index b52d782..ad2f6c4 100644
--- a/src/test/java/org/apache/sysds/test/applications/GLMTest.java
+++ b/src/test/java/org/apache/sysds/test/applications/GLMTest.java
@@ -264,6 +264,7 @@ public class GLMTest extends AutomatedTestBase
                
                int expectedNumberOfJobs = -1; // 31;
 
+               setOutputBuffering(false);
                runTest(true, EXCEPTION_NOT_EXPECTED, null, 
expectedNumberOfJobs);
 
                double max_abs_beta = 0.0;

Reply via email to