note 101334 modified in splfixedarray.fromarray by danbrown
| From: | danbrown@php.net | Date: | Fri, 10 Dec 2010 17:30:29 +0000 |
| Subject: | note 101334 modified in splfixedarray.fromarray by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174780@lists.php.net to get a copy of this message | ||
Memory footprint tests :
<?php
echo memory_get_usage()."\n"; // display 627760
$array = array_fill( 0, 2048, 'a' );
echo memory_get_usage()."\n"; // 824744, so 196984 for $array
unset( $array );
echo memory_get_usage()."\n"; // 627792
$spl=SplFixedArray::fromArray( array_fill( 0, 2048, 'a' ) );
echo memory_get_usage()."\n"; //644944, so just 17151 for $spl !!!
?>
--was--
Memory footprint tests :
echo memory_get_usage()."\n"; // display 627760
$array = array_fill( 0, 2048, 'a' );
echo memory_get_usage()."\n"; // 824744, so 196984 for $array
unset( $array );
echo memory_get_usage()."\n"; // 627792
$spl=SplFixedArray::fromArray( array_fill( 0, 2048, 'a' ) );
echo memory_get_usage()."\n"; //644944, so just 17151 for $spl !!!
http://php.net/manual/en/splfixedarray.fromarray.php