3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php gc_enable(); class x { public $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); while(gc_collect_cycles() == 0) { } var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n";
based on HTqvd
Output for 7.1.0
string(9) "5.652.968" string(9) "6.295.552"
Process exited with code 137.
Output for 7.0.0 - 7.0.14
string(9) "5.653.032" 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.832"
Process exited with code 137.
Output for hhvm-3.10.0
string(9) "6.291.456" string(9) "4.556.224"
Process exited with code 137.
Output for 5.6.7 - 5.6.28
string(10) "10.349.720" string(10) "10.747.904"
Process exited with code 137.
Output for 5.5.24 - 5.5.35
string(10) "10.349.712" string(10) "10.747.904"
Process exited with code 137.
Output for 5.4.0 - 5.4.45
string(10) "10.350.200" string(10) "10.747.904"
Process exited with code 137.
Output for 5.3.11 - 5.3.29
string(10) "10.755.672" string(10) "11.272.192"
Process exited with code 137.
Output for 5.3.9 - 5.3.10
string(10) "10.755.544" string(10) "11.272.192"
Process exited with code 137.