Skip to content

php propel long running scripts like crons are reaching the memory limit

I really and a long time thought about a problem with a cronjob php skript. This script has to run long (in php terms, very long or lets say longer than one hour). I implemented a lot of verbose output and figured out that the script is using more and more memory. Thats why i implemented the using of "gc_enable()" and "gc_collect_cycles" without less luck. After a while i tackeld it down to my favorit used php orm mapper called propel. After having "propel" in my mind, the instance pooling comes in my mind and the final fix was reachable.

\Propel::disableInstancePooling();
Add the code on top to your script and the memoryusage should not increase anymore (or you have another memory hole ;-)).

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Markdown format allowed
Form options