Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A {
- public $a;
- public function bind(&$a) {
- $this->a = &$a;
- }
- public function set($a) {
- $this->a = $a;
- }
- }
- echo "start: " . memory_get_usage(true). "\n";
- $a = new A();
- $b = array();
- for ($i = 0; $i < 100000; $i++) {
- $b[] = array('c' => $i);
- }
- echo "generated: " . memory_get_usage(true). "\n";
- $a->bind($b);
- echo "binded: " . memory_get_usage(true). "\n";
- foreach ($a->a as $i) {
- foreach ($i as $inner) {
- continue;
- }
- }
- echo "iterated: " . memory_get_usage(true). "\n\n";
- unset($a);
- unset($b);
- echo "cleanup: " . memory_get_usage(true). "\n";
- echo "\n";
- $a = new A();
- $b = array();
- for ($i = 0; $i < 100000; $i++) {
- $b[] = array('c' => $i);
- }
- echo "generated: " . memory_get_usage(true). "\n";
- $a->set($b);
- echo "set: " . memory_get_usage(true). "\n";
- foreach ($a->a as $i) {
- foreach ($i as $inner) {
- continue;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement