public function run(array $argv, $exit = true, $memoryTracking = true, $bootstrap = null)
 {
     require_once __DIR__ . '/../printer/SerializePrinter.php';
     $this->arguments['printer'] = $this->handlePrinter('phpunit_parallel\\printer\\SerializePrinter');
     if ($bootstrap) {
         $this->arguments['bootstrap'] = $bootstrap;
     }
     $this->handleConfig();
     $runner = $this->createRunner();
     while ($testDetails = fgets(STDIN)) {
         if ($memoryTracking) {
             gc_collect_cycles();
         }
         if ($request = TestRequest::decode($testDetails)) {
             SerializePrinter::getInstance()->setCurrentRequest($request);
             $escapedClassName = str_replace('\\', '\\\\', $request->getClass());
             $this->arguments['filter'] = "^{$escapedClassName}::{$request->getName()}\$";
             $suite = new \PHPUnit_Framework_TestSuite($request->getClass());
             $suite->addTestFile($request->getFilename());
             $result = $runner->doRun($suite, $this->arguments);
             if ($result->count() === 0) {
                 $this->showError($request, "Test not found!");
             } elseif ($result->count() > 1) {
                 $this->showError($request, "Multiple tests executed!");
             }
         }
     }
     return 0;
 }
Esempio n. 2
0
 /**
  * Runtime of Master process
  * @return void
  */
 protected function run()
 {
     Daemon::$process = $this;
     $this->prepareSystemEnv();
     class_exists('Timer');
     // ensure loading this class
     gc_enable();
     /* This line must be commented according to current libevent binding implementation. May be uncommented in future. */
     //$this->eventBase = new \EventBase;
     if ($this->eventBase) {
         $this->registerEventSignals();
     } else {
         $this->registerSignals();
     }
     $this->workers = new Collection();
     $this->collections['workers'] = $this->workers;
     $this->ipcthreads = new Collection();
     $this->collections['ipcthreads'] = $this->ipcthreads;
     Daemon::$appResolver->preload(true);
     $this->callbacks = new StackCallbacks();
     $this->spawnIPCThread();
     $this->spawnWorkers(min(Daemon::$config->startworkers->value, Daemon::$config->maxworkers->value));
     $this->timerCb = function ($event) use(&$cbs) {
         static $c = 0;
         ++$c;
         if ($c > 0xfffff) {
             $c = 1;
         }
         if ($c % 10 == 0) {
             gc_collect_cycles();
         }
         if (!$this->lastMpmActionTs || microtime(true) - $this->lastMpmActionTs > $this->minMpmActionInterval) {
             $this->callMPM();
         }
         if ($event) {
             $event->timeout();
         }
     };
     if ($this->eventBase) {
         // we are using libevent in Master
         Timer::add($this->timerCb, 1000000.0 * Daemon::$config->mpmdelay->value, 'MPM');
         while (!$this->breakMainLoop) {
             $this->callbacks->executeAll($this);
             if (!$this->eventBase->dispatch()) {
                 break;
             }
         }
     } else {
         // we are NOT using libevent in Master
         $lastTimerCall = microtime(true);
         while (!$this->breakMainLoop) {
             $this->callbacks->executeAll($this);
             if (microtime(true) > $lastTimerCall + Daemon::$config->mpmdelay->value) {
                 call_user_func($this->timerCb, null);
                 $lastTimerCall = microtime(true);
             }
             $this->sigwait();
         }
     }
 }
 public function onRequest($stream, $remote_addr)
 {
     $this->in_request = true;
     if (false === $this->protocol->readRequest($stream, $remote_addr)) {
         return;
     }
     $context = array('env' => $this->protocol->getHeaders(), 'stdin' => $this->protocol->getStdin(), 'logger' => function ($message) {
         echo $message . "\n";
     });
     $result = call_user_func($this->app, $context);
     unset($context);
     if (!is_array($result) or count($result) != 3) {
         throw new BadProtocolException("App did not return proper result");
     }
     try {
         $this->protocol->writeResponse($result);
     } catch (NoStreamException $e) {
         $this->log('output stream is gone. cleaning up');
     }
     // cleanup
     unset($result);
     $this->protocol->doneWithRequest();
     $this->in_request = false;
     gc_collect_cycles();
     if ($this->should_stop) {
         die;
     }
 }
Esempio n. 4
0
 public function tearDown()
 {
     parent::tearDown();
     // without forcing garbage collection, the DB connections
     // are not guaranteed to be disconnected; force GC
     gc_collect_cycles();
 }
 /**
  * [jwage: 10000 objects in ~6 seconds]
  */
 public function testHydrationPerformance()
 {
     $s = microtime(true);
     $batchSize = 20;
     for ($i = 1; $i <= 10000; ++$i) {
         $user = new CmsUser();
         $user->status = 'user';
         $user->username = '******' . $i;
         $user->name = 'Mr.Smith-' . $i;
         $this->dm->persist($user);
         if ($i % $batchSize == 0) {
             $this->dm->flush();
             $this->dm->clear();
         }
     }
     gc_collect_cycles();
     echo "Memory usage before: " . memory_get_usage() / 1024 . " KB" . PHP_EOL;
     $users = $this->dm->getRepository('Documents\\CmsUser')->findAll();
     foreach ($users as $user) {
     }
     $this->dm->clear();
     gc_collect_cycles();
     echo "Memory usage after: " . memory_get_usage() / 1024 . " KB" . PHP_EOL;
     $e = microtime(true);
     echo 'Hydrated 10000 objects in ' . ($e - $s) . ' seconds' . PHP_EOL;
 }
 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $db = $this->getContainer()->get('doctrine')->getManager();
     $importlogfile = "import.correct.machines.distributions";
     $distributions = $db->getRepository('SywFrontMainBundle:Distributions')->findByLower('machinesnum', '50');
     foreach ($distributions as $distribution) {
         $machines = null;
         unset($machines);
         $machines = $distribution->getMachines();
         $mnum = count($machines);
         $desc = $distribution->getDescription();
         if ($mnum <= 49 && ($desc == null || trim($desc) == "")) {
             $mnum = -999999;
             foreach ($machines as $machine) {
                 $machine->setDistribution(null);
                 $db->persist($machine);
             }
         }
         $distribution->setMachinesNum($mnum);
         $db->persist($distribution);
         $db->flush();
         gc_collect_cycles();
     }
     gc_collect_cycles();
 }
Esempio n. 7
0
 public function init($vars, $class = __CLASS__)
 {
     $this->calle = '';
     $this->departamento = '';
     $this->piso = '';
     $this->numero = '';
     if (isset($vars)) {
         $reflexion = new ReflectionClass($this);
         foreach ($vars as $key => $value) {
             foreach ($reflexion->getMethods() as $reflexion_method) {
                 if ($reflexion_method->name == 'set_' . $key) {
                     $this->{"set_" . $key}($value);
                 }
             }
             if ($key == 'id_localizacion') {
                 $this->set_id($value);
             }
         }
         unset($reflexion);
         /*
         foreach ($vars as $key => $value){
         	if(array_key_exists($key, get_class_vars($class))){
         		if(method_exists($this, "set_" . $key)){
         			$this->{"set_". $key}($value);
         		}
         	}
         	if($key == 'id_localizacion') {
         		$this->set_id($value);
         	}
         }
         */
     }
     gc_collect_cycles();
 }
Esempio n. 8
0
 public function parse($source, $type = 'file', $is_object = true)
 {
     if ('file' === $type and $this->isRelativePath($source)) {
         $source = $this->path('config', $source);
     }
     $resolve = [];
     foreach ($this->path as $tag => $ignored) {
         $resolve['!' . $tag . '_path'] = function ($value) use($tag) {
             return $this->path($tag, $value);
         };
     }
     foreach (get_class_methods($this) as $method) {
         if (0 === strpos($method, '__resolve_')) {
             $tag = substr($method, strlen('__resolve_'));
             $resolve['!' . $tag] = [$this, $method];
         }
     }
     $parse = ['file' => 'yaml_parse_file', 'url' => 'yaml_parse_url', 'string' => 'yaml_parse'][$type];
     $out = $parse($source, 0, $ignored, $resolve);
     if ($is_object) {
         $class =& $out['class'];
         unset($out['class']);
         $out = $class ? new $class($out) : new Factory($out);
     }
     gc_collect_cycles();
     return $out;
 }
Esempio n. 9
0
 public function import($file, OutputInterface $output)
 {
     $csvFile = new CsvFile($file);
     $csv = $csvFile->getCsv();
     $progress = new ProgressBar($output, 100);
     $progress->start();
     $cpt = 0;
     $cptTotal = 0;
     foreach ($csv as $data) {
         $etablissement = $this->createFromImport($data, $output);
         if (!$etablissement) {
             continue;
         }
         $this->dm->persist($etablissement);
         $cptTotal++;
         if ($cptTotal % (count($csv) / 100) == 0) {
             $progress->advance();
         }
         if ($cpt > 1000) {
             $this->dm->flush();
             $this->dm->clear();
             gc_collect_cycles();
             $cpt = 0;
         }
         $cpt++;
     }
     $this->dm->flush();
     $progress->finish();
 }
Esempio n. 10
0
 public function clearMemory()
 {
     accessControlPeer::clearInstancePool();
     BatchJobPeer::clearInstancePool();
     BulkUploadResultPeer::clearInstancePool();
     categoryPeer::clearInstancePool();
     EmailIngestionProfilePeer::clearInstancePool();
     entryPeer::clearInstancePool();
     FileSyncPeer::clearInstancePool();
     flavorAssetPeer::clearInstancePool();
     flavorParamsConversionProfilePeer::clearInstancePool();
     flavorParamsOutputPeer::clearInstancePool();
     flavorParamsPeer::clearInstancePool();
     kshowPeer::clearInstancePool();
     mediaInfoPeer::clearInstancePool();
     moderationFlagPeer::clearInstancePool();
     moderationPeer::clearInstancePool();
     notificationPeer::clearInstancePool();
     roughcutEntryPeer::clearInstancePool();
     SchedulerConfigPeer::clearInstancePool();
     SchedulerPeer::clearInstancePool();
     SchedulerStatusPeer::clearInstancePool();
     SchedulerWorkerPeer::clearInstancePool();
     StorageProfilePeer::clearInstancePool();
     syndicationFeedPeer::clearInstancePool();
     TrackEntryPeer::clearInstancePool();
     uiConfPeer::clearInstancePool();
     UploadTokenPeer::clearInstancePool();
     // TODO clear default filters
     // TODO call all memory cleaner plugins
     if (function_exists('gc_collect_cycles')) {
         // php 5.3 and above
         gc_collect_cycles();
     }
 }
Esempio n. 11
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $points = DestinationPoint::with(['city', 'country'])->whereNull('destination_points.latitude')->orderBy('id')->get();
     $count = 0;
     foreach ($points as $point) {
         $count++;
         if (0 == $count % 1000) {
             $unprocessed_points = DestinationPoint::with(['city', 'country'])->whereNull('destination_points.latitude')->count();
             $collected_cycles_count = gc_collect_cycles();
             $this->comment($unprocessed_points . ' unprocessed destination points (' . $this->getMemoryUsage() . ' / ' . $collected_cycles_count . ' cycles)');
         }
         if (!($country = $point->country()->first())) {
             return $this->error("Skipped point #{$point->id}: country not found");
         }
         if (!($city = $point->city()->first())) {
             return $this->error("Skipped point #{$point->id}: city not found");
         }
         $address = $point->address;
         if (false === mb_strpos($address, $city->name)) {
             $address = $city->name . ', ' . $address;
         }
         if (false === mb_strpos($address, $country->name)) {
             $address = $country->name . ', ' . $address;
         }
         try {
             if ($point = $this->geocode($point, $address)) {
                 $point->save();
             }
         } catch (ChainNoResultException $e) {
             $this->error("Not founded {$address}");
         }
     }
     return;
 }
 protected function tearDown()
 {
     //Close & unsets
     if (is_object($this->em)) {
         $this->em->getConnection()->close();
         $this->em->close();
     }
     unset($this->em);
     unset($this->container);
     unset($this->kern);
     unset($this->client);
     //Nettoyage des mocks
     //http://kriswallsmith.net/post/18029585104/faster-phpunit
     $refl = new \ReflectionObject($this);
     foreach ($refl->getProperties() as $prop) {
         if (!$prop->isStatic() && 0 !== strpos($prop->getDeclaringClass()->getName(), 'PHPUnit_')) {
             $prop->setAccessible(true);
             $prop->setValue($this, null);
         }
     }
     //Nettoyage du garbage
     if (!gc_enabled()) {
         gc_enable();
     }
     gc_collect_cycles();
     //Parent
     parent::tearDown();
 }
 protected function tearDown()
 {
     // Unset to keep database connections from piling up.
     $this->backend = null;
     // Collect garbages manually to free up connections.
     gc_collect_cycles();
 }
Esempio n. 14
0
 /**
  * Flush image data from memory.
  *
  * @param bool $collect_garbage
  */
 public function flush($collect_garbage = true)
 {
     $this->data = null;
     if ($collect_garbage) {
         gc_collect_cycles();
     }
 }
Esempio n. 15
0
 public function tearDown()
 {
     $this->as = null;
     $this->ccm = null;
     $this->executor = null;
     gc_collect_cycles();
 }
Esempio n. 16
0
 public function dataNone(UnitTester $I)
 {
     $I->wantTo("Use Memory cache with None frontend");
     $frontend = new None(['lifetime' => 10]);
     $backend = new Memory($frontend);
     $I->assertFalse($backend->isStarted());
     $backend->save('test-data', 'nothing interesting');
     $I->assertEquals('nothing interesting', $backend->get('test-data'));
     $backend->save('test-data', 'something interesting');
     $I->assertEquals('something interesting', $backend->get('test-data'));
     $I->assertTrue($backend->exists('test-data'));
     $I->assertTrue($backend->delete('test-data'));
     $string = str_repeat('a', 5000000);
     $backend->save('test-data', $string);
     $s1 = $backend->get('test-data');
     $s2 = $backend->get('test-data');
     $s3 = $backend->get('test-data');
     $I->assertEquals($s1, $s2);
     $I->assertEquals($s1, $s3);
     $I->assertEquals(strlen($s1), 5000000);
     $I->assertEquals($s1, $string);
     $I->assertTrue($backend->delete('test-data'));
     unset($s1, $s2, $s3);
     gc_collect_cycles();
     $s1 = $frontend->afterRetrieve($string);
     $s2 = $frontend->afterRetrieve($string);
     $s3 = $frontend->afterRetrieve($string);
     $I->assertEquals($s1, $s2);
     $I->assertEquals($s1, $s3);
     $I->assertEquals($s1, $string);
 }
 /**
  * Creates groups for registered users.
  * Must be called explicitly or hooked into activation.
  */
 public static function activate()
 {
     global $wpdb;
     // create a group for the blog if it doesn't exist
     if (!($group = Groups_Group::read_by_name(self::REGISTERED_GROUP_NAME))) {
         $group_id = Groups_Group::create(array("name" => self::REGISTERED_GROUP_NAME));
     } else {
         $group_id = $group->group_id;
     }
     if ($group_id) {
         $n = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users}");
         for ($i = 0; $i < $n; $i += self::BATCH_LIMIT) {
             $users = $wpdb->get_results($wpdb->prepare("SELECT ID FROM {$wpdb->users} LIMIT %d, %d", $i, self::BATCH_LIMIT));
             foreach ($users as $user) {
                 // add the user to the group
                 if (!Groups_User_Group::read($user->ID, $group_id)) {
                     Groups_User_Group::create(array("user_id" => $user->ID, "group_id" => $group_id));
                 }
             }
             unset($users);
             if (function_exists('gc_collect_cycles')) {
                 gc_collect_cycles();
             }
         }
     }
 }
Esempio n. 18
0
 /**
  * {@inheritDoc}
  */
 public function run(callable $onStart = null)
 {
     if ($this->state !== self::STOPPED) {
         throw new \LogicException("Cannot run() recursively; event reactor already active");
     }
     if ($onStart) {
         $this->state = self::STARTING;
         $onStartWatcherId = $this->immediately($onStart);
         $this->tryImmediate($this->watchers[$onStartWatcherId]);
         if (empty($this->keepAliveCount) && empty($this->stopException)) {
             $this->state = self::STOPPED;
         }
     } else {
         $this->state = self::RUNNING;
     }
     while ($this->state > self::STOPPED) {
         $immediates = $this->immediates;
         foreach ($immediates as $watcher) {
             if (!$this->tryImmediate($watcher)) {
                 break;
             }
         }
         if (empty($this->keepAliveCount) || $this->state <= self::STOPPED) {
             break;
         }
         \uv_run($this->loop, $this->immediates ? \UV::RUN_NOWAIT : \UV::RUN_ONCE);
     }
     \gc_collect_cycles();
     $this->state = self::STOPPED;
     if ($this->stopException) {
         $e = $this->stopException;
         $this->stopException = null;
         throw $e;
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $startTime = microtime(true);
     $batchSize = 1000;
     $em = $this->getContainer()->get('doctrine')->getEntityManager();
     $repository = $this->getContainer()->get('doctrine')->getRepository('AppBundle:Student');
     $students = $repository->getStudents();
     $i = 0;
     while (($row = $students->next()) !== false) {
         $student = $row[0];
         $student->setPath($this->getContainer()->get('get.path')->getPath($student));
         $i++;
         if ($i % $batchSize === 0) {
             echo memory_get_usage() / 1048576 . 'MB';
             echo "\r\n";
             $em->flush();
             $em->clear();
             gc_collect_cycles();
         }
     }
     $em->flush();
     echo "\r\n";
     $endTime = microtime(true);
     echo $endTime - $startTime;
 }
Esempio n. 20
0
 /**
  * {@inheritDoc}
  */
 public function run(callable $onStart = null)
 {
     if ($this->state !== self::STOPPED) {
         throw new \LogicException("Cannot run() recursively; event reactor already active");
     }
     if ($onStart) {
         $this->state = self::STARTING;
         $watcherId = $this->immediately($onStart);
         if (!$this->tryImmediate($this->watchers[$watcherId]) || empty($this->keepAliveCount)) {
             return;
         }
     } else {
         $this->state = self::RUNNING;
     }
     $this->enableTimers();
     while ($this->state > self::STOPPED) {
         $this->doTick($noWait = false);
         if (empty($this->keepAliveCount)) {
             break;
         }
     }
     \gc_collect_cycles();
     $this->timersEnabled = false;
     $this->state = self::STOPPED;
 }
Esempio n. 21
0
 /**
  */
 public function makeImages()
 {
     foreach ($this->types as $type => $options) {
         $this->makeImage($type);
         gc_collect_cycles();
     }
 }
Esempio n. 22
0
 private static function huffman_lookup_init()
 {
     gc_disable();
     $encodingAccess = [];
     $terminals = [];
     foreach (self::HUFFMAN_CODE as $chr => $bits) {
         $len = self::HUFFMAN_CODE_LENGTHS[$chr];
         for ($bit = 0; $bit < 8; $bit++) {
             $offlen = $len + $bit;
             $next =& $encodingAccess[$bit];
             for ($byte = (int) (($offlen - 1) / 8); $byte > 0; $byte--) {
                 $cur = \str_pad(\decbin($bits >> $byte * 8 - (0x30 - $offlen) % 8 & 0xff), 8, "0", STR_PAD_LEFT);
                 if (isset($next[$cur]) && $next[$cur][0] != $encodingAccess[0]) {
                     $next =& $next[$cur][0];
                 } else {
                     $tmp =& $next;
                     unset($next);
                     $tmp[$cur] = [&$next, null];
                 }
             }
             $key = \str_pad(\decbin($bits & (1 << ($offlen - 1) % 8 + 1) - 1), ($offlen - 1) % 8 + 1, "0", STR_PAD_LEFT);
             $next[$key] = [null, $chr > 0xff ? "" : \chr($chr)];
             if ($offlen % 8) {
                 $terminals[$offlen % 8][] = [$key, &$next];
             } else {
                 $next[$key][0] =& $encodingAccess[0];
             }
         }
     }
     $memoize = [];
     for ($off = 7; $off > 0; $off--) {
         foreach ($terminals[$off] as &$terminal) {
             $key = $terminal[0];
             $next =& $terminal[1];
             if ($next[$key][0] === null) {
                 foreach ($encodingAccess[$off] as $chr => &$cur) {
                     $next[($memoize[$key] ?? ($memoize[$key] = \str_pad($key, 8, "0", STR_PAD_RIGHT))) | $chr] = [&$cur[0], $next[$key][1] != "" ? $next[$key][1] . $cur[1] : ""];
                 }
                 unset($next[$key]);
             }
         }
     }
     $memoize = [];
     for ($off = 7; $off > 0; $off--) {
         foreach ($terminals[$off] as &$terminal) {
             $next =& $terminal[1];
             foreach ($next as $k => $v) {
                 if (\strlen($k) != 1) {
                     $next[$memoize[$k] ?? ($memoize[$k] = \chr(\bindec($k)))] = $v;
                     unset($next[$k]);
                 }
             }
         }
     }
     unset($tmp, $cur, $next, $terminals, $terminal);
     gc_enable();
     gc_collect_cycles();
     return $encodingAccess[0];
 }
Esempio n. 23
0
 /**
  * Runtime of Master process
  * @return void
  */
 public function run()
 {
     Daemon::$process = $this;
     $this->prepareSystemEnv();
     class_exists('Timer');
     // ensure loading this class
     gc_enable();
     $this->eventBase = event_base_new();
     $this->registerEventSignals();
     FS::initEvent();
     $this->fileWatcher = new FileWatcher();
     $this->workers = new ThreadCollection();
     $this->collections['workers'] = $this->workers;
     Daemon::$appResolver = (require Daemon::$config->path->value);
     $this->IPCManager = Daemon::$appResolver->getInstanceByAppName('IPCManager');
     Daemon::$appResolver->preload(true);
     $this->callbacks = new SplStack();
     $this->spawnWorkers(min(Daemon::$config->startworkers->value, Daemon::$config->maxworkers->value));
     Timer::add(function ($event) use(&$cbs) {
         $self = Daemon::$process;
         static $c = 0;
         ++$c;
         if ($c > 0xfffff) {
             $c = 1;
         }
         if ($c % 10 == 0) {
             $self->workers->removeTerminated(true);
             gc_collect_cycles();
         } else {
             $self->workers->removeTerminated();
         }
         if (isset(Daemon::$config->mpm->value) && is_callable(Daemon::$config->mpm->value)) {
             call_user_func(Daemon::$config->mpm->value);
         } else {
             // default MPM
             $state = Daemon::getStateOfWorkers($self);
             if ($state) {
                 $n = max(min(Daemon::$config->minspareworkers->value - $state['idle'], Daemon::$config->maxworkers->value - $state['alive']), Daemon::$config->minworkers->value - $state['alive']);
                 if ($n > 0) {
                     Daemon::log('Spawning ' . $n . ' worker(s).');
                     $self->spawnWorkers($n);
                     event_base_loopbreak($self->eventBase);
                 }
                 $n = min($state['idle'] - Daemon::$config->maxspareworkers->value, $state['alive'] - Daemon::$config->minworkers->value);
                 if ($n > 0) {
                     Daemon::log('Stopping ' . $n . ' worker(s).');
                     $self->stopWorkers($n);
                 }
             }
         }
         $event->timeout();
     }, 1000000.0 * Daemon::$config->mpmdelay->value, 'MPM');
     while (!$this->breakMainLoop) {
         while (!$this->callbacks->isEmpty()) {
             call_user_func($this->callbacks->shift(), $this);
         }
         event_base_loop($this->eventBase);
     }
 }
Esempio n. 24
0
/**
 *
 * @ignore
 */
function memory_and_gc($str)
{
    $before = memory_get_usage(true);
    gc_enable();
    $gcs = gc_collect_cycles();
    $after = memory_get_usage(true);
    print "Memory usage at the {$str} : " . convert($before) . ". After GC: " . convert($after) . " and freed {$gcs} variables\n";
}
Esempio n. 25
0
 function __destruct()
 {
     echo "-> ";
     $a = array();
     $a[] =& $a;
     unset($a);
     var_dump(gc_collect_cycles());
 }
Esempio n. 26
0
 public function run()
 {
     $this->message->reply("Memory in use before garbage collection: " . memory_get_usage() / 1024 / 1024 . "MB");
     gc_collect_cycles();
     $this->message->reply("Memory in use after garbage collection: " . memory_get_usage() / 1024 / 1024 . "MB");
     // Mark this as garbage
     $this->isGarbage();
 }
Esempio n. 27
0
 /**
  * This method is called after the last test of this test class is run.
  */
 protected function tearDown()
 {
     if ($this->dom) {
         $this->dom->clear();
     }
     $this->dom = null;
     gc_collect_cycles();
 }
Esempio n. 28
0
 protected function iterate($seconds)
 {
     sleep($seconds);
     if (!gc_enabled()) {
         gc_enable();
     }
     gc_collect_cycles();
 }
 private function gc()
 {
     LanguageObjectPeer::clearInstancePool();
     DocumentPeer::clearInstancePool();
     SearchIndexPeer::clearInstancePool();
     SearchIndexWordPeer::clearInstancePool();
     gc_collect_cycles();
 }
Esempio n. 30
0
 /**
  * @BeforeScenario
  */
 public function clearConnections()
 {
     $this->connections = ['@master' => ['params' => $this->masterParams(), 'instance' => null, 'last-result' => null, 'last-error' => null]];
     $connection = $this->rootConnection();
     $connection->close();
     $connection = null;
     gc_collect_cycles();
 }