fork(6) download
  1. <?php
  2.  
  3. $array = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
  4.  
  5. $oldway = true;
  6.  
  7. if ($oldway) {
  8. while (true)
  9. {
  10. /* does basically nothing, but creates functions for each array element */
  11. $array = array_map(create_function('$o', 'return $o;'), $array);
  12.  
  13. echo memory_get_usage() ."\n";
  14.  
  15. sleep(1);
  16. }
  17.  
  18. } else {
  19. while (true)
  20. {
  21. /* does basically nothing, but creates functions for each array element */
  22. $array = array_map(function($o) { return $o; }, $array);
  23.  
  24. echo memory_get_usage() ."\n";
  25.  
  26. sleep(1);
  27. }
  28. }
Time limit exceeded #stdin #stdout 5s 25752KB
stdin
Standard input is empty
stdout
116524
116756
116968
117180
117392
117604
117816
118028
118240
118452
118664