3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php gc_enable(); class x { private $value; public function __construct($value) { $this->value = $value; } } $array = array(); for($i = 0; $i < 50000; $i++) { $array[] = md5('Hallo'); } $x = new x($array); var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n"; unset($array); unset($x); sleep(4); var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n";
based on 2RCZf
Output for 7.1.0
string(9) "5.652.496" string(9) "6.295.552"
Process exited with code 137.
Output for 7.0.0 - 7.0.14
string(9) "5.652.544" string(9) "6.295.552"
Process exited with code 137.
Output for hhvm-3.12.0
string(9) "6.291.456" string(9) "4.557.816"
Process exited with code 137.
Output for hhvm-3.10.0
string(9) "6.291.456" string(9) "4.556.208"
Process exited with code 137.
Output for 5.6.7 - 5.6.28
string(10) "10.349.560" string(10) "10.747.904"
Process exited with code 137.
Output for 5.5.24 - 5.5.35
string(10) "10.349.568" string(10) "10.747.904"
Process exited with code 137.
Output for 5.4.10 - 5.4.45
string(10) "10.350.120" string(10) "10.747.904"
Process exited with code 137.
Output for 5.4.0 - 5.4.9
string(10) "10.350.096" string(10) "10.747.904"
Process exited with code 137.
Output for 5.3.11 - 5.3.29
string(10) "10.755.448" string(10) "11.272.192"
Process exited with code 137.
Output for 5.3.9 - 5.3.10
string(10) "10.755.256" string(10) "11.272.192"
Process exited with code 137.