Long term Data is not getting populated | PiHole v5.3.1

You could try How do I increase PHP's memory? - #3 by deHakkelaar.
That may or may not mitigate your issue, and possibly only temporarily until the next limit is hit.

Before you do so, please consider to address the underlying cause.
Memory is exhausted by huge volumes of queries, and I wouldn't expect that to be the case for a single month, unless you have a very active network with more than just a few clients.

Also, closing a full or partial DNS loop may cause queries to be repeated excessively.
Your debug log shows that you are using Conditional Fowarding, so a partial DNS loop may contribute to a higher volume of DNS requests.

Run from your Pi-hole machine, what's the output of:

echo ">stats >quit" | nc localhost 4711
echo ">top-clients >quit" | nc localhost 4711