note 76888 added to function.shm-attach
| From: | jpeter1978 at yahoo dot com | Date: | Fri, 03 Aug 2007 22:35:46 +0000 |
| Subject: | note 76888 added to function.shm-attach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129160@lists.php.net to get a copy of this message | ||
I tried all the suggestions above for getting the object size (in bytes) for $memsize, but they
didn't work universally for the two types of objects I tried (string and array of strings).
After doing some googling and experimenting, I've found the following magic formula:
$memsize = ( strlen( serialize( $object ) ) + 44 ) * 2;
I found this in someone else's code, so I can't explain it.
----
Server IP: 64.71.164.2
Probable Submitter: 24.120.62.134
----
Manual Page -- http://www.php.net/manual/en/function.shm-attach.php
Edit -- https://master.php.net/note/edit/76888
Del: integrated -- https://master.php.net/note/delete/76888/integrated
Del: useless -- https://master.php.net/note/delete/76888/useless
Del: bad code -- https://master.php.net/note/delete/76888/bad+code
Del: spam -- https://master.php.net/note/delete/76888/spam
Del: non-english -- https://master.php.net/note/delete/76888/non-english
Del: in docs -- https://master.php.net/note/delete/76888/in+docs
Del: other reasons-- https://master.php.net/note/delete/76888
Reject -- https://master.php.net/note/reject/76888
Search -- https://master.php.net/manage/user-notes.php