EchoEum
Posts: 56
Joined: Mon Aug 01, 2016 1:01 pm

Auto Clear RAM

Fri Dec 02, 2016 3:40 pm

i am using my pi to extend my WiFi by outputting the WiFi thought the Ethernet port to another router.

Everything works well until the RAM fills up and I have to reboot the Pi.

Is there a way I can set the RAM to auto clear when it reaches a certain point?

Cheers,

Echo

User avatar
RaTTuS
Posts: 10684
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Auto Clear RAM

Fri Dec 02, 2016 3:55 pm

fix your code so it doesn't fill up..
how are you achieving this system ?
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

W. H. Heydt
Posts: 13955
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Auto Clear RAM

Fri Dec 02, 2016 6:40 pm

Sounds like the software you're using has a memory leak. If properly written, it would allocate the space it needs and release space it no longer needs. As the previous poster said: Fix the software.

User avatar
TimG
Posts: 302
Joined: Tue Apr 03, 2012 12:15 am
Location: Switzerland

Re: Auto Clear RAM

Fri Dec 02, 2016 8:26 pm

If you're not able to fix the memory leak, take a look at the Linux watchdog (https://linux.die.net/man/5/watchdog.conf). It can automatically reboot the system whenever the free memory runs dangerously low. It can even run a "repair" script before resorting to a reboot, which could attempt to kill and restart the offending process. Not a very "nice" solution, but reliable and easy to implement.

mfa298
Posts: 1386
Joined: Tue Apr 22, 2014 11:18 am

Re: Auto Clear RAM

Fri Dec 02, 2016 9:29 pm

EchoEum wrote:i am using my pi to extend my WiFi by outputting the WiFi thought the Ethernet port to another router.

Everything works well until the RAM fills up and I have to reboot the Pi.

Is there a way I can set the RAM to auto clear when it reaches a certain point?
How are you determining your ram is filling up meaning you have to reboot ?

By default Linux will use spare ram to cache recently opened files helping to speed things up, this ram is still available to applications if they need it. For instance looking at the ram on one of my PiBs I get the following output.

Code: Select all

root@draco:~# free -m
             total       used       free     shared    buffers     cached
Mem:           434        345         89          8         40        259
-/+ buffers/cache:         46        388
Swap:           99          0         99
Whilst the first line makes it look like I've only got 89MB ram free, in reality 259MB (over half my ram) is used for the cache.
The 2nd line gives a slightly more useful set of values if you want to know what's available for running applications.

EchoEum
Posts: 56
Joined: Mon Aug 01, 2016 1:01 pm

Re: Auto Clear RAM

Wed Dec 07, 2016 4:35 pm

Thanks for all the replies. I did a fresh install on my SD card and everything seems to be working now. :D

Return to “General discussion”