Skip to content

Fix out of memory error

Compare
Choose a tag to compare
@janmartenjongerius janmartenjongerius released this 12 Oct 06:18
· 64 commits to master since this release
b42c529

When a ReflectionClass from BetterReflection was requested statically,
it created a new instance of BetterReflection under the hood. This
instance of BetterReflection created a new PHP parser under the hood,
every time. So, every time a PHP symbol was reflected upon, the whole
parser was instantiated, which was really memory consuming.

In the case of issue #25, this resulted in an out of memory error,
requesting over 1GB of memory to run Dependency Guard.

By preventing zealous object instantiation, the memory consumption is
now below a set threshold of 25MB of memory for the package that was
affected in issue #25.

Thanks to @willemstuursma for reporting the bug.