<?php $arr = []; /* record T(int $x, int $y); */ readonly class T { public function __construct(public int $x, public int $y) {}} // emulate a record $t = new T(1,2); for($x = 0; $x <= 100_000; $x++) $arr[] = $t /* &T(1,2) */ ; echo "Current memory usage: " . (memory_get_usage() / 1024) . " KB\n"; echo "Peak memory usage: " . (memory_get_peak_usage() / 1024) . " KB\n";
You have javascript disabled. You will not be able to edit any code.