[Vinecopula-commits] r116 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Di Aug 11 10:23:13 CEST 2015


Author: tnagler
Date: 2015-08-11 10:23:12 +0200 (Tue, 11 Aug 2015)
New Revision: 116

Modified:
   pkg/R/RVineCopSelect.r
   pkg/R/RVineSeqEst.R
   pkg/R/RVineStructureSelect.r
Log:
* RVineSeqEst, RVineCopSelect, RVineStructureSelect: free before returning results (memory usage kept increasing in R-3.3.0)

Modified: pkg/R/RVineCopSelect.r
===================================================================
--- pkg/R/RVineCopSelect.r	2015-08-11 08:20:17 UTC (rev 115)
+++ pkg/R/RVineCopSelect.r	2015-08-11 08:23:12 UTC (rev 116)
@@ -122,11 +122,12 @@
         }
     }
     
-    ## return results
-    RVM <- RVineMatrix(Mold, 
-                       family = Types,
-                       par = Params,
-                       par2 = Params2, 
-                       names = varnames)
-    return(RVM)
+    ## free memory and return results
+    .RVM <- RVineMatrix(Mold, 
+                        family = Types,
+                        par = Params,
+                        par2 = Params2, 
+                        names = varnames)
+    rm(list = ls())
+    .RVM
 }

Modified: pkg/R/RVineSeqEst.R
===================================================================
--- pkg/R/RVineSeqEst.R	2015-08-11 08:20:17 UTC (rev 115)
+++ pkg/R/RVineSeqEst.R	2015-08-11 08:23:12 UTC (rev 116)
@@ -168,12 +168,16 @@
         }
     }
     
+    ## store results
     oldRVM$par <- Params
     oldRVM$par2 <- Params2
-    
     if (se == FALSE) {
-        return(list(RVM = oldRVM))
+        .out <- list(RVM = oldRVM)
     } else {
-        return(list(RVM = oldRVM, se = seMat1, se2 = seMat2))
+        .out <- list(RVM = oldRVM, se = seMat1, se2 = seMat2)
     }
+    
+    ## free memory and return results
+    rm(list = ls())
+    .out
 }

Modified: pkg/R/RVineStructureSelect.r
===================================================================
--- pkg/R/RVineStructureSelect.r	2015-08-11 08:20:17 UTC (rev 115)
+++ pkg/R/RVineStructureSelect.r	2015-08-11 08:23:12 UTC (rev 116)
@@ -82,8 +82,10 @@
         RVine$Graph[[i]] <- g
     }
     
-    ## return results as 'RVineMatrix' object
-    as.RVM(RVine)
+    ## free memory and return results as 'RVineMatrix' object
+    .RVine <- RVine
+    rm(list = ls())
+    as.RVM(.RVine)
 }
 
 ## full graph with Kendall's tau as edge weights



Mehr Informationen über die Mailingliste Vinecopula-commits