winzou / state-machine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[RFC] Add a clear method to the factory

patrick-mcdougle opened this issue · comments

In long batch processes that use the state machine, the factory gets very large (as more state machines are added to it). Additionally since each state machine stores the actual entity objects within it, the memory for them can never be freed by the garbage collector (and subsequently the objects that they refer to as well). Is there some way that application level code, could unset some or all of the state machines in the factory? I know that I could just write my own Factory implementation that does that, but this seems like a feature that might be important to the rest of the open-source community.

I propose a clear() that simply sets $stateMachines = [];

Thoughts?