-->
Page 1 of 3

memory leak ??

PostPosted: Sun Apr 12, 2015 4:45 am
by grooves
Hi,

first of all, thanks for sharing the project, great work,
It seems to be a small memory leak, you can check ist very easy with your design, just add:
os_sprintf(buff, "%ld %lu", hitCounter, (unsigned long)system_get_free_heap_size());
in cgi.c
you can see that the free memory gets smaller and smaller with every page call.
I'm sure you can fix that,
looking forward for OTA updates, :-)

Regards,
grooves

Re: memory leak ??

PostPosted: Sun Apr 12, 2015 5:26 am
by Sprite_tm
I'll look into it. I do know, however, that closed sockets tend to linger for some minutes in the esp stack. Do you happen to have checked if the memory loss persists in the longer term?

Re: memory leak ??

PostPosted: Mon Apr 13, 2015 2:42 am
by grooves
you are right, when there is a minute between two calls the free memory increases a little bit,
but just few bytes.
It doesn't come back to the free heap at start time,
in general it wastes memory, not much but it does

Regards,
grooves

Re: memory leak ??

PostPosted: Wed Apr 15, 2015 9:02 am
by krzychb
I am glad grooves brought this issue and I observe exactly the same. After each webpage load the heap size decreases. It recovers after several seconds / minutes. The problem is that no matter how long you wait between subsequent webpage loads the heap does not fully recover. I have tested it extensively with couple of latest SDKs releases including SDK v1.0.1 b1. I am using the toolchain and esphttpd copy provided under http://programs74.ru/udkew-en.html.