On Jan 7, 2008 3:45 AM, Sancar Saran <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I just wonder to how can I find a memory size of an array.
>
> Regards
>
> Sancar
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
If you're wondering how much memory your array is taking up engine
wise you can do a few little tests. Of course you could do the echo
serialize form but that isn't going to tell you how much memory it
uses internally within the engine itself. Granted this might not
either, but it is at least a little closer.
var_dump(memory_get_usage());
$array = array(
1 => 'one',
2 => 'two',
3 => 'three'
);
var_dump(memory_get_usage());
Output:
int(53464)
int(53928)
Also Xdebug trace:
Version: 2.0.0
TRACE START [2008-01-08 14:13:17]
1 0 0 0.004355 51968 {main} 1
/Users/eric/Sites/blah.php 0
1 0 1 0.004833 52328
0.0052 23184
TRACE END [2008-01-08 14:13:17]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php