Flutter: Exhausted heap space, trying to allocate 8589934608 bytes and laptop stops responding

Some times flutter clean works for me.

But When flutter clean does not work then I apply below technique:

I push my project to git repository(I used Bitbucket) and delete this existing project. Then pull my project from git repository and setup my project. After all my project working as usual.

Try flutter clean along with flutter channel master && flutter upgrade