fork download
  1. <?php
  2.  
  3. memory_status();
  4.  
  5. $a = range(0, 99);
  6. $b = array_fill(0, 100, $a);
  7. $c = array_fill(0, 100, $b);
  8.  
  9. memory_status();
  10.  
  11. foreach ($c as &$v1) {
  12. foreach ($v1 as &$v2) {
  13. foreach ($v2 as &$v3) {
  14. // do nothing
  15. }
  16. }
  17. }
  18.  
  19. memory_status();
  20.  
  21. function memory_status() {
  22. static $last;
  23. echo "Current memory usage: $usage";
  24. if ($last) {
  25. echo ", delta from last call: ".($usage - $last);
  26. }
  27.  
  28. echo "\n";
  29. $last = $usage;
  30. }
Success #stdin #stdout 0.58s 20520KB
stdin
Standard input is empty
stdout
Current memory usage: 119024
Current memory usage: 134324, delta from last call: 15300
Current memory usage: 78595888, delta from last call: 78461564