Browse Source

Memory improvements

Jordi Boggiano 10 years ago
parent
commit
9173d937cf

+ 1 - 0
src/Packagist/WebBundle/Command/DumpPackagesCommand.php

@@ -70,6 +70,7 @@ class DumpPackagesCommand extends ContainerAwareCommand
         $timeout = 30*60;
 
         ini_set('memory_limit', -1);
+        gc_enable();
 
         // another dumper is still active
         if (file_exists($lock) && filemtime($lock) > time() - $timeout) {

+ 2 - 2
src/Packagist/WebBundle/Package/SymlinkDumper.php

@@ -230,15 +230,14 @@ class SymlinkDumper
                     // store affected files to clean up properly in the next update
                     $this->fs->mkdir(dirname($buildDir.'/'.$name));
                     $this->writeFile($buildDir.'/'.$name.'.files', json_encode(array_keys($affectedFiles)));
-                    $modifiedIndividualFiles[$name.'.files'] = true;
 
                     $package->setDumpedAt($dumpTime);
                 }
 
                 // update dump dates
                 $this->doctrine->getManager()->flush();
+                unset($packages, $package, $version);
                 $this->doctrine->getManager()->clear();
-                unset($packages);
 
                 if ($current % 250 === 0 || !$packageIds) {
                     if ($verbose) {
@@ -494,6 +493,7 @@ class SymlinkDumper
         }
 
         $this->individualFiles = array();
+        $this->individualFilesMtime = array();
     }
 
     private function dumpIndividualFile($path, $key)