cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR: There is not enough free space

daniele239955_stm1
Associate
Posted on July 22, 2016 at 16:06

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-space
6 REPLIES 6
Posted on July 27, 2016 at 10:54

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.

Regards

jerry

daniele239955_stm1
Associate
Posted on July 29, 2016 at 10:42

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,

daniele

Posted on July 29, 2016 at 18:10

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

Mareike H
Associate II
Posted on May 09, 2017 at 13:40

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

Posted on May 09, 2017 at 15:52

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

Posted on May 31, 2017 at 17:18

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.