<?php
// makes a big map
$map = [];
for($a = 0; $a < 55555; $a++){
$map["key" . $a] = (object)(array)["x" => $a];
}
// empty the map (or partially empty it)
for($a = 0; $a < 55555; $a++){
unset($map["key" . $a]);
}
// at this point $map's length is nexPow2(55555), even if it is empty
$om = memory_get_usage();
echo $om . "\n";
(function(array $map){
$map["sup"] = "copy";
// copy on write allocates another nexPow2(55555) array,
// rather than starting with a small one
$nm = memory_get_usage();
echo $nm . "\n";
})($map);
Abusive script
This script was stopped while abusing our resources