13 const APP_REINITIALIZATION_LOOPS = 20;
22 if (defined(
'HHVM_VERSION')) {
23 $this->markTestSkipped(
"Test not relevant because no gc in HHVM.");
25 $this->_helper = new \Magento\TestFramework\Helper\Memory(
26 new \
Magento\Framework\Shell(
new \
Magento\Framework\Shell\CommandRenderer())
35 $this->markTestSkipped(
'Test fails at Travis. Skipped until MAGETWO-47111');
37 $this->_deallocateUnusedMemory();
38 $actualMemoryUsage = $this->_helper->getRealMemoryUsage();
39 for (
$i = 0;
$i < self::APP_REINITIALIZATION_LOOPS;
$i++) {
41 $this->_deallocateUnusedMemory();
43 $actualMemoryUsage = $this->_helper->getRealMemoryUsage() - $actualMemoryUsage;
44 $this->assertLessThanOrEqual(
45 $this->_getAllowedMemoryUsage(),
48 "Application reinitialization causes the memory leak of %u bytes per %u iterations.",
50 self::APP_REINITIALIZATION_LOOPS
72 return \Magento\TestFramework\Helper\Memory::convertToBytes(
'2M');
testAppReinitializationNoMemoryLeak()
_deallocateUnusedMemory()