fractal icon indicating copy to clipboard operation
fractal copied to clipboard

Fixing memory leaks when fractal used in daemons

Open AtCliffUnderline opened this issue 1 year ago • 2 comments

Due to every transformer being filled with the current scope, there is a reference recursion.

Transformer -> Scope -> Resource -> Transformer -> Scope...

This causes memory leaks in daemons and workers, I guess because GC is not able to collect these cyclomatic references; even running gc_collect_cycles after each job is not helping.

I think this is not breaking change, but kind of messy. Begging for comments and help with this issue

AtCliffUnderline avatar Apr 09 '23 20:04 AtCliffUnderline

Hello. I also need to run fractal in long-lived applications. My opinion is that the transformer should be immutable and the method setCurrentScope should be removed.

gam6itko avatar May 12 '24 11:05 gam6itko

Hey @AtCliffUnderline look at my solution of this issue. I hope it will help you to avoid memory leaks

https://github.com/thephpleague/fractal/pull/569

gam6itko avatar May 14 '24 20:05 gam6itko