Created
August 31, 2012 11:24
-
-
Save fabianbraun/3551667 to your computer and use it in GitHub Desktop.
Memory usage test
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
<?php | |
class Foo { | |
function __construct() | |
{ | |
$this->bar = new Bar($this); | |
} | |
} | |
class Bar { | |
function __construct($foo = null) | |
{ | |
$this->foo = $foo; | |
} | |
} | |
$i = 0; | |
while (true) { | |
$foo = new Foo(); | |
// $foo->__destruct(); | |
unset($foo); | |
$i++; | |
if ($i % 100000 == 0) { | |
echo number_format(memory_get_usage()) . "\n"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copied from here: http://paul-m-jones.com/archives/262