title: How to extend ESP32 heap size?
body: <p>I'm writing a code about play gif from SDCard on TFT Screen, so I create a array to put the gif file. (Using Nodemcu-32s 4MB)</p>
  <pre><code>#include&lt;TFT_eSPI.h&gt;
  #include&lt;SPI.h&gt;
  #include&lt;AnimatedGIF.h&gt;
  
  TFT_eSPI tft;
  AnimatedGIF gif;
  uint8_t *gifArray;
  int gifArrayLen;
  
  void setup(){
    tft.init();
    tft.setRotation(2);
    tft.fillScreen(TFT_BLACK);
  
    File fgif=SD.open(&quot;/test.gif&quot;,FILE_READ);
    gifArrayLen=fgif.size();
    gifArray=(uint8_t *)malloc(gifArrayLen);
    for(int i=0;i&lt;gifArrayLen;i++) gifArray[i]=fgif.read();
    fgif.close();
  }
  
  void loop(){
    tft.startWrite();
    gif.open(gifArray,gifArrayLen*sizeof(uint8_t),GIFDraw);
    while(gif.playFrame(true,NULL)) yield();
    gif.close();
    tft.endWrite();
  }
  </code></pre>
  <p>But if gif size &gt; 131KB, it will trigger fatal error like this.</p>
  <p><code>Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.</code></p>
  <p>After malloc the array, when I set a value on it, it triggered.</p>
  <p>I found some forum says it's because it over the FreeRTOS heap size.</p>
  <p>Can I extend the heap size or use another storage method to replace it?</p>