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

Used to consume memory

WBOY
Release: 2016-07-25 09:09:08
Original
806 people have browsed it
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


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template