Skip to content
Advertisement

Tag: garbage-collection

PHP: Having some memory issues inside a loop

I have a snippet that resembles the following: This snippet should run as a daemon service, but I’m having a lot of trouble making this work. The issue: each iteration increases the process memory usage. As if at each new iteration a new $myObject is being instantiated, but the previous one remains allocated in memory, and such. I have tried:

Disable Garbage Collection

How do I disable garbage collection for a long running php cli script? I am handling unsetting of variables in the script. Answer Unsetting variables does not free memory! It just removes the reference from the variable to the corresponding value. Once any value have a ref-count of 0 the GC collects the value and frees its allocated memory. If

Advertisement