3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class NonLeakingClass { } function test(){ $ret = []; for($i=0;$i<100000;$i++){ $ret[]= new NonLeakingClass(); } return $ret; } $i=0; echo "test?".PHP_EOL; echo memory_get_usage()."\n"; while($i++<10){ if($i==1){ $a=test(); echo memory_get_usage()."\n"; unset($a); } echo memory_get_usage()."\n"; } gc_collect_cycles(); echo memory_get_usage()."\n";
based on hYkfE

Abusive script

This script was stopped while abusing our resources

Output for 7.3.0beta2 - 7.3.0beta3
test? 388960 9627824 1429344 1429344 1429344 1429344 1429344 1429344 1429344 1429344 1429344 1429344 1429344
Output for 7.3.0beta1
test? 388960
Process exited with code 137.
Output for 7.3.0alpha1 - 7.3.0alpha4
test? 388984 9627848 1429368 1429368 1429368 1429368 1429368 1429368 1429368 1429368 1429368 1429368 1429368
Output for 7.2.0 - 7.2.2, 7.2.4 - 7.2.8, 7.2.10
test? 385136 9624000 1425520 1425520 1425520 1425520 1425520 1425520 1425520 1425520 1425520 1425520 1425520
Output for 7.2.3, 7.2.9
test? 385136
Process exited with code 137.
Output for 7.1.0 - 7.1.1, 7.1.7 - 7.1.14, 7.1.17 - 7.1.19, 7.1.21
test? 348528 9587392 1388912 1388912 1388912 1388912 1388912 1388912 1388912 1388912 1388912 1388912 1388912
Output for 7.1.15 - 7.1.16, 7.1.20
test? 348528
Process exited with code 137.
Output for 7.1.2 - 7.1.6
test? 348888 9587752 1389272 1389272 1389272 1389272 1389272 1389272 1389272 1389272 1389272 1389272 1389272
Output for 7.0.31
test? 348560
Process exited with code 137.
Output for 7.0.28 - 7.0.30
test? 348560 9587424 1388944 1388944 1388944 1388944 1388944 1388944 1388944 1388944 1388944 1388944 1388944
Output for hhvm-3.21.3 - 3.22.0
test? 2097152 6295552 4194304 4194304 4194304 4194304 4194304 4194304 4194304 4194304 4194304 4194304 4194304
Output for hhvm-3.18.5
test? 2097152 6291456 4194304 4194304 4194304 4194304 4194304 4194304 4194304 4194304 4194304 4194304 4194304
Output for 5.6.30
test? 221016 27993336 8544120 8544120 8544120 8544120 8544120 8544120 8544120 8544120 8544120 8544120 8544120