-
-
Save mikeschinkel/183b4b33a65d6880b924 to your computer and use it in GitHub Desktop.
Example code to see how much memory a small class consumes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "<br>"; | |
echo memory_get_usage(); | |
class Foobar { | |
var $a = 'abcdefghijklmnopqrstuvwxyz'; | |
var $b = 1000; | |
var $c = false; | |
var $d; | |
function __construct() { | |
$this->d = array( | |
'a' => $this->a, | |
'b' => $this->b, | |
'c' => $this->c, | |
); | |
} | |
} | |
$fb= new Foobar(); | |
echo "<br>"; | |
echo memory_get_usage(); | |
class Foobar1 { | |
} | |
echo "<br>"; | |
echo memory_get_usage(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment