Release Heap Memory used by WiFi

daneduplooy
Posts: 1
Joined: Thu Jul 11, 2024 7:17 am

Release Heap Memory used by WiFi

Postby daneduplooy » Thu Jul 11, 2024 7:32 am

Hello! :)

We have a project where we implement WiFi Station + AP, but then disable the AP after a minute. It does not seem that all heap memory used by the AP is released however, as there is still ~4kb less heap available after disabling the AP than there is if the AP is simply not started at all.
Starting the STA and AP is standard code (as per examples). We use the following code to stop the WiFi again:

Code: Select all

        esp_wifi_stop();
        esp_wifi_deinit();
        esp_wifi_set_mode(WIFI_MODE_NULL);
        if (mpWiFiSta) { // mpWiFiSta = esp_netif_create_default_wifi_sta(); in init routine
            esp_netif_destroy(mpWiFiSta);
            mpWiFiSta = 0;
        }
        if (mpWiFiAp) { // mpWiFiAp = esp_netif_create_default_wifi_ap(); in init routine
            esp_netif_destroy(mpWiFiAp);
            mpWiFiAp = 0;
        }
and then we start again only the STA (not the AP).

What else should we do to release the additional ~4kb reserved during AP initialisation back into the heap?

Thanks!

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], PhilipK and 74 guests