<?php
/**
* [clean class]
* 1.500 => 515.09 KB
* 15.000 => 1.56 MB
* 150.000 => 16.09 MB
*
* [1 field]
* 1.500 => 538.44 KB
* 15.000 => 1.79 MB
* 150.000 => 18.38 MB
*
* [3 field]
* 1.500 => 597.52 KB
* 15.000 => 2.37 MB
* 150.000 => 24.1 MB
*/
final class CustomClass
{
# private string $result = 'access';
# private float $begin_time = 4738.994;
# private float $run_time = 7264.544;
}
function memory_converter_to_string(int $size): string
{
$unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
return round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i];
}
$cached = array();
$begin = 0;
$limit = 1500;
for ($index = $begin; $index < $limit; $index++)
{
$cached[$index] = new CustomClass();
}
echo memory_converter_to_string(memory_get_peak_usage()) . PHP_EOL;
To embed this project on your website, copy the following code and paste it into your website's HTML: