PHP Fatal Error: Allow Memory Size
The error is telling you "Allowed memory size of 536870912 bytes exhausted" - you ran out of memory. It's not necessarily this line of code that's the problem, but you have one or more memory hogs somewhere in your app using up about 500MB.
This line just happens to be the one that caused you to exceed the limit.
Refer to this reference answer for how to investigate and fix errors like this.