Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

flutter

When I run my flutter project it was giving me this error below, making my laptop stops responding.

Exhausted heap space, trying to allocate 8589934608 bytes

Screenshot:

enter image description here

I am trying,

  1. flutter clean
  2. Restart my android studio

But Error occur again and again and my laptop sotps responding.

How to resolve this issue?

like image 765
Md Mahmudul Islam Avatar asked May 08 '20 08:05

Md Mahmudul Islam


3 Answers

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.

like image 139
Md Mahmudul Islam Avatar answered Oct 10 '22 18:10

Md Mahmudul Islam


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

like image 35
SempaiLeo Avatar answered Oct 10 '22 19:10

SempaiLeo


Thanks @Md Mahmudul Islam. In my case one extra steps solved the issue smoothly.

-Flutter Clean

-Flutter upgrade [upgrade 1.17.2 to 1.17.4]

-Increase Android studio Heap memory :

Program Files->Android->Android Studio->bin->studio64.exe.vmoptions

Open the file and increase the value -Xmx1280m as you want. I changed -Xmx1280 to -Xmx2280

You can also see on bottom right corner, how much memory used in your program by enabling this

File->Settings->Appearance->check 'Show memory indicator'

Note : Try to upgrade Flutter on Latest stable version

like image 1
Mimu Saha Tishan Avatar answered Oct 10 '22 18:10

Mimu Saha Tishan