- memory_get_usage: documentation ( source)
- gc_enable: documentation ( source)
- number_format: documentation ( source)
- md5: documentation ( source)
<?php
gc_enable();
class x { private $value; public function __construct($value) { $this->value = $value; }}for($j = 0; $j < 100; $j++) { $array = array(); $objects = array(); for($i = 0; $i < 5000; $i++) { $value = md5('Hallo'); $objects[] = new x($value); $array[] = $value; } echo number_format(memory_get_usage(true), 0,',','.') . "\n"; unset($array); unset($objects); unset($value); echo number_format(memory_get_usage(true), 0,',','.') . "\n";}