1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

The magical gc_disable()

Discussion in 'General PHP and MySQL Discussions' started by tyteen4a03, Dec 3, 2014.

  1. tyteen4a03

    tyteen4a03 Well-Known Member

  2. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    I did and the timing dropped about .02s :p
     
  3. tyteen4a03

    tyteen4a03 Well-Known Member

    I don't think places outside the Deferred system would benefit much from using it, unless of course you are loading more than 100k objects per request (which means you have a bigger problem)
     
  4. RoldanLT

    RoldanLT Well-Known Member

    So to implement, I will modify or add into my custom php.ini this code
    Code:
    zend.enable_gc = Off
    Right?
     
  5. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    yes... or add this to config.php:
    PHP:
    gc_disable();
    I only tested it on normal actions... will check what happens while deferring...
     
    RoldanLT likes this.
  6. RoldanLT

    RoldanLT Well-Known Member

    at the very bottom, will do?
     
  7. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    yes.
     
    RoldanLT likes this.
  8. tyteen4a03

    tyteen4a03 Well-Known Member

    Garbage Collection has its uses so I don't recommend blindly turning it off.
     
  9. Xon

    Xon Well-Known Member

    gc_disable only affects the garbage collector used to detect and dispose of circular references between objects.

    For long lived objects which live for the entire request, it is worthless. And the current php implementation is in fact is actively harmful if you have lots of things allocated, because the threshold which triggers this GC isn't configurable or self-tuning.
     
  10. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    isn't garbage collector related to global vars? I don't have that much idea about gc so I might be wrong...
     
  11. tyteen4a03

    tyteen4a03 Well-Known Member

    Which goes back to what I was saying: Deferred. I can see circular reference happening much more often than your typical page rendering. You shouldn't need to turn this off for normal web requests (and if you do, you probably need to review your code)
     

Share This Page