diff --git a/httpd/httpdespfs.c b/httpd/httpdespfs.c index 959835a..1caf8d8 100644 --- a/httpd/httpdespfs.c +++ b/httpd/httpdespfs.c @@ -179,6 +179,7 @@ int ICACHE_FLASH_ATTR cgiEspFsTemplate(HttpdConnData *connData) { //We're done. ((TplCallback)(connData->cgiArg))(connData, NULL, &tpd->tplArg); espFsClose(tpd->file); + os_free(tpd); return HTTPD_CGI_DONE; } else { //Ok, till next time. diff --git a/user/user_main.c b/user/user_main.c index e6e158b..9252754 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -75,6 +75,12 @@ HttpdBuiltInUrl builtInUrls[]={ }; +static ETSTimer prHeapTimer; + +static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg) { + os_printf("Heap: %ld\n", (unsigned long)system_get_free_heap_size()); +} + //Main routine. Initialize stdout, the I/O, filesystem and the webserver and we're done. void user_init(void) { stdoutInit(); @@ -84,5 +90,8 @@ void user_init(void) { // where image is written in flash that is defined in Makefile. espFsInit((void*)(0x40200000 + ESPFS_POS)); httpdInit(builtInUrls, 80); + os_timer_disarm(&prHeapTimer); + os_timer_setfn(&prHeapTimer, prHeapTimerCb, NULL); + os_timer_arm(&prHeapTimer, 3000, 1); os_printf("\nReady\n"); }