2016-07-22 07:06 AM
I'm using the module in MiniAP mode , I write once a second a file ''data.json'' in the RAM memory pages.
I'm using a sequence like this :
''AT+S.FSD=/data.json'' ....
''AT+S.FSC=/data.json,512'' ....
the file size is 260 byte max, so the file is
quite
lower the the max_size=4096 form the manual.
anything seems OK but
suddenly,
after
some seconds, I got the error message:
''ERROR: There is not enough free space''
when I try to create the file.
I've update the module to the last
SPWF01S-160129-c5bf5ce-RELEASE-main.ota
fw.
The
only
way I've found to free memory is to reset the module using
AT+cfun=1
but in this way the client will be detached.
I suspect some problem related to the module heap, after the error I print the heap values:
ERROR: There is not enough free space
AT+S.STS=min_heap
♯ min_heap = 7008
AT+S.STS=free_heap
♯ free_heap = 8072
There are some other way to free the memory?
how can I mange this situation?
I'm doing something wrong ?
regards, daniele #memory-space2016-07-27 01:54 AM
Ciao Daniele,
filesystem is a raw dynamic list. When free_heap is too low (under a fixed threshold, around 9-10Kb), FSC raises the error ''There is not enough free space''.
RAM is allocated by FSC, and freed by FSD.As far as I know/tested, there is no memory leak. Moreover, since release 3.5, FSC automatically deletes old files with the same name. So, I expect FSD is no more needed if file is going to be overwritten. Use FSR if want to rename.Regardsjerry2016-07-29 01:42 AM
Hy,
I've tried also to work without FSD command, it work, but no changes about memory error.One information more ... the error appear only (or mainly) when I connect some device to the miniAP , moreover not all devices has the same impact, if I connect a PC it seems ok, when I connect an android tablet the error appear, not immediately after some time anyway.I've supposed that some dynamic memory will be consumed when the device will be connected to to miniAP , so this can have an impact on FSC command also, but is just an hypo....Anyway what will be great, in my case, since I need to rewrite always the same file with the same dimension but just different content , should avoid to continuously reallocate the file memory area but just reuse the same, e.g. with a different command (zap) ?regards,daniele2016-07-29 09:10 AM
Ciao Daniele,
miniAP uses much more RAM than STA. It's normal behavior to get ''not enough free space'' mainly in miniAP (rather than STA).
Currently there is no way to avoid realloc. I expect anyway malloc will reuse previously freed heap, since size is exactly the same, if no others malloc occurred in the meanwhile. So... 99% of times!
Best regards
jerry
2017-05-09 04:40 AM
Hello,
I have almost the same problem. I want to realise a countdown on a webpage, controlled by a microcontroller.
I'm using the module in MiniAP mode and write once a second a file 'count.js' in the RAM memory with these commands:AT+S.FSC=/count.js,12
AT+S.FSA=/count.js,12 var a = 702;As long as I don't browse to the webpage it is working.
When I open my webpage 'countdown.html' and then try to execute the FSC-command I get the Error: There is not enough free space.Here is the webpage (countdown.html):<html>
<head></head> <body> <div id='time'></div> <script type='text/javascript' language='JavaScript'> refreshScript(); countdownInterval = setInterval(refreshScript,1000); function refreshScript() { var script = document.createElement('script'); script.src = 'count.js'; script.onload = function () { if(typeof a !='undefined') { document.getElementById('time').innerHTML = Math.floor(a/60)+' min '+a%60+' sec'; } }; document.head.appendChild(script); } </script> </body></html>I think the problem is that you can't execute the FSC-command while the webpage is reading the file. As the reading needs time there is no possibility to create a new file.
Can anyone reproduce my error-message?
Do you have any idea how I can realise the countdown?Thanks in advance!Mareike
2017-05-09 08:52 AM
Hi
Mareike,
I suggest to try reducing the ip_wait_timeout. I expect connections to webserver are cleared much must faster. So, RAM is available soon again.
BR
jerry
2017-05-31 10:18 AM
Thank you for your answer!
When I reduced the ip_wait_timeout, the page was loaded very slowly.I will try the new module SPWF04. Perhaps the behavior is better because it has more RAM.