Home >Backend Development >PHP Tutorial >Used to consume memory

Used to consume memory

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-25 09:09:08845browse
A piece of code that consumes server memory.
  1. class Foo {
  2. function __construct()
  3. {
  4. $this->bar = new Bar($this);
  5. }
  6. }
  7. class Bar {
  8. function __construct($foo = null)
  9. {
  10. $this->foo = $foo;
  11. }
  12. }
  13. while (true) {
  14. $foo = new Foo();
  15. unset($foo);
  16. echo number_format(memory_get_usage()) . "/n";
  17. }
  18. ?>
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Paging implementationNext article:Paging implementation