|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello,
I just wonder to how can I find a memory size of an array. Regards Sancar |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Sancar Saran wrote:
> Hello, > > I just wonder to how can I find a memory size of an array. > > Regards > > Sancar Found this: http://www.usenet-forums.com/php-gen...ize-bytes.html Maybe out of date, but apparently there's no other way but to write it yourself. -thib´ |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Sancar Saran wrote:
> Hello, > > I just wonder to how can I find a memory size of an array. <wild guess> echo strlen(serialize($array)); </wild guess> -- Postgresql & php tutorials http://www.designmagick.com/ |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Jan 7, 2008 3:45 AM, Sancar Saran <sancar.saran@evodot.com> 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] |
|
![]() |
| Outils de la discussion | |
|
|