Now, I don't know how to approach for the fix as I don't really understand what's really happening here.
Please let me know about the error and what should I do to fix this?

Thanks a lot.
I went through many posts but couldn't really find a solution. How exactly is micropython allocating memory here? What's "allocating 964 bytes"?
There really is no way to give you an answer without having all code and running on the exact same platform you have. The rest is guesswork. Unless you have a stacktrace or so.How exactly is micropython allocating memory here?
Again, impossible to tell. You can figure it out yourself, for example by adding/removing blocks of statements until the error occurs.Is this error due to file sizes?