I believe this is the root cause for many of the OOM errors we've been
seeing.
Our original analysis pointed toward:
1. repos with big minified js files (resolved by skipping those)
1. php-only repos (mysterious...)
Since ripping off the bandaid Monday and surfacing OOM errors to
end-users, we've been hearing about several PHP-only repos that are
erroring, so I took some time to read through the php parsing code
looking for a possible memory leak.
Eventually I noticed that we're using OpenStruct to represent our "Node"
concept for the php AST that we build. I've heard that OpenStruct isn't
very memory-efficient or fast and decided to try refactoring away from
it.
I'm able to reproduce the OOM error via the CLI on my clone of
etsy/phan, and the error no longer occurs with this refactor.
:tada: :tada: :tada: