- Output for 8.2.0 - 8.2.14, 8.3.0 - 8.3.1
- int(1339208) int(1339240) int(1470368)
- Output for 8.1.0 - 8.1.27
- int(1601656) int(1601688) int(1732816)
<?php
class A extends \stdClass {
public int $i = 42;
public function __unserialize($properties) {
foreach ($properties as $key => $property) {
$this->$key = $property;
}
}
}
$holder = [];
for ($i = 0; $i < 10000; $i++) {
$holder[] = new A;
}
var_dump(memory_get_usage());
foreach ($holder as $obj) {
}
var_dump(memory_get_usage());
$unserialized_holder = [];
foreach ($holder as $obj) {
$unserialized_holder[] = \unserialize(\serialize($obj));
}
unset($holder);
var_dump(memory_get_usage());