How to clean RAM after closing programs?

Booting, installing, newbie
Message
Author
User avatar
pp4mnklinux
Posts: 375
Joined: Fri 23 Aug 2013, 06:56

How to clean RAM after closing programs?

#1 Post by pp4mnklinux »

Hello everybody:

I have got CONKY installed on my pc, so I have a bar showing how many RAM I am using each moment.


When I have a lot of programs opened (22 browsers tabs and 3 browsers, the gimp, openshot....) some times my puppy hangs on, becaus all the RAM is bussy.

I can use th mouse because it doesn't respond my orders, so....

HOW CAN I RECOVER RAM CLOSING ALL PROGRAMS?



HAVE A NICE DAY. THANKY FOR YOUR ANSWERS.


XENIAL PUP 7.5 X64
Distro: xenialpup64 7.5 XXL
Desktop Panel: JWM ~ FbBox 5.0

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#2 Post by nic007 »

echo 3 > /proc/sys/vm/drop_caches

BTW - You need to use a swapfile or swap partition if you don't have enough RAM.

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#3 Post by Mike Walsh »

@ pp4mnklinux:-

Totally 'off-topic', I know, but..... I can't quite figure this out. I occasionally have two browsers open, myself.....but three..???

The way browser developers are going these days, browsers are becoming enormous pieces of software; they easily consume the largest individual chunk of your RAM, whenever they are open. Take Nic's advice by all means.....but you may want to re-think your usage patterns. Some of this sounds like it's self-inflicted, y'know.


Mike. :wink:

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#4 Post by rufwoof »

Mike Walsh wrote:..... I can't quite figure this out. I occasionally have two browsers open, myself.....but three..???
Hi Mike.

If you have lots of tabs open then the tabs can become unreadable. For instance I'm running iridium and the tabs compress down narrower and narrower the more that are opened. Opening a second/third browser instance and spreading the tabs out across those helps. Or you might want to group tabs and do so via having separate browser sessions running. Also for some services a simple text browser might suffice, news or IRC etc.

Image is a clickable thumbnail of when I move the mouse into the bottom left corner (skippy-xd window selector) ... three browser sessions each with multiple tabs. Clicking any one presents that full screen and I can then click the desired tab within that as desired

Image
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
d_vineet
Posts: 116
Joined: Mon 06 Aug 2018, 05:32
Location: Bharat

Re: HOW TO CLEAN RAM?

#5 Post by d_vineet »

pp4mnklinux wrote: HOW CAN I RECOVER RAM CLOSING ALL PROGRAMS?
@pp4mnklinux :-
If you wish to 'kill' all programs, you may try 'Menu' -- 'Utility' -- XKill.
I don't know whether or not you can click on menu (since you mentioned that the mouse is unresponsive, but you can move it). It is not quite clear to me.
You may also post here your h/w specs (esp. physical memory), how many tabs are open at a time.
Just now I tried opening multiple tabs on my lappy.
Chromium - 15 tabs.
Iridium - 15 tabs.
Firefox - 15 tabs.
(and task manager).
Memory used is 1123 MB.
(content is not loaded in some tabs though. If loaded, the RAM usage will increase accordingly).[/img]
Attachments
ram_usage.png
screenshot of my RAM usage with 3 browsers with 15 tabs each.
(223.18 KiB) Downloaded 416 times

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#6 Post by Flash »

rufwoof wrote:
Mike Walsh wrote:..... I can't quite figure this out. I occasionally have two browsers open, myself.....but three..???
Hi Mike.

If you have lots of tabs open then the tabs can become unreadable. For instance I'm running iridium and the tabs compress down narrower and narrower the more that are opened. Opening a second/third browser instance and spreading the tabs out across those helps. Or you might want to group tabs and do so via having separate browser sessions running. Also for some services a simple text browser might suffice, news or IRC etc.

Image is a clickable thumbnail of when I move the mouse into the bottom left corner (skippy-xd window selector) ... three browser sessions each with multiple tabs. Clicking any one presents that full screen and I can then click the desired tab within that as desired

Image
Rather than start a whole new instance of the browser, I open a new window in the browser (File -> New -> Browser Window). That shows up in the tray at the bottom, gives me more room for tabs and, I assume, uses less of my computer's resources than starting another instance of the browser. Am I wrong?

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#7 Post by rufwoof »

On mine, starting a new instance or starting a new window doesn't seem to make any difference as to how much additional ram is used.
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
pp4mnklinux
Posts: 375
Joined: Fri 23 Aug 2013, 06:56

I have enought ram for normal use

#8 Post by pp4mnklinux »

nic007 wrote:echo 3 > /proc/sys/vm/drop_caches

BTW - You need to use a swapfile or swap partition if you don't have enough RAM.

thanky, I have enought ram for normal use .- 4gb, but I need to recover it at specific times



THANKY
Distro: xenialpup64 7.5 XXL
Desktop Panel: JWM ~ FbBox 5.0

User avatar
pp4mnklinux
Posts: 375
Joined: Fri 23 Aug 2013, 06:56

I FOUND THE PROBLEM

#9 Post by pp4mnklinux »

HELLO EVERYBODY:

I WAS WORKING HARD WITH MY PC in order to send u a screen with my use of the computer, when it blocked again.


I found that the problem is not the RAM, but a scrip which hang on the computer.

I send two screens, hosted at google drive


https://photos.google.com/photo/AF1QipO ... E4BAAmkS6V


https://photos.google.com/photo/AF1QipM ... Sp17lwyop5


thanky
Distro: xenialpup64 7.5 XXL
Desktop Panel: JWM ~ FbBox 5.0

ITSMERSH

#10 Post by ITSMERSH »

22 browsers tabs
:shock:

May be you should get a hobby in real life? :wink:

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#11 Post by Mike Walsh »

Flash wrote:
rufwoof wrote:
Mike Walsh wrote:..... I can't quite figure this out. I occasionally have two browsers open, myself.....but three..???
Hi Mike.

If you have lots of tabs open then the tabs can become unreadable. For instance I'm running iridium and the tabs compress down narrower and narrower the more that are opened. Opening a second/third browser instance and spreading the tabs out across those helps. Or you might want to group tabs and do so via having separate browser sessions running. Also for some services a simple text browser might suffice, news or IRC etc.

Image is a clickable thumbnail of when I move the mouse into the bottom left corner (skippy-xd window selector) ... three browser sessions each with multiple tabs. Clicking any one presents that full screen and I can then click the desired tab within that as desired

Image
Rather than start a whole new instance of the browser, I open a new window in the browser (File -> New -> Browser Window). That shows up in the tray at the bottom, gives me more room for tabs and, I assume, uses less of my computer's resources than starting another instance of the browser. Am I wrong?
No, I believe you're right, Flash.

I do very much the same thing when I run Netflix in its own, separate window (essentially turning that one tab into its own 'app', which you can do with Chrome.) In fact, I've set-up a script that starts Netflix by itself, in its own window, without opening the actual browser.....and started by a Menu entry for ease of use. That way, you essentially replace the opening of the 'app' from the Apps page.

Unfortunately, although you can watch Netflix in Firefox these days, you can't do this particular 'trick' with it. That's a Chrome-only 'special'.

I've had this open at the same time as Chrome itself being open, and the increase in RAM/thread usage (as measured by gKrellM, and xload in the 'tray'), is negligible.


Mike. :wink:

linuxcbon
Posts: 1312
Joined: Thu 09 Aug 2007, 22:54

#12 Post by linuxcbon »

@pp4mnklinux : use palemoon, it should use less ram than chrome or firefox

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#13 Post by Flash »

rufwoof wrote:On mine, starting a new instance or starting a new window doesn't seem to make any difference as to how much additional ram is used.
It may depend on the browser you're using. I use SeaMonkey. Mike Walsh uses Chrome.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#14 Post by musher0 »

Hello pp4mnklinux.

To come back to your question in the title of this thread:
"How to clean RAM after closing programs?",

I don't know about gimp, etc., but for the browsers: browsers have a setting
in their config panel to purge their cache(s) when you close them. Set that to
yes, and you'll have an easy, no-fuss, automatic, way to clean a big part of
your RAM.

IHTH.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#15 Post by rufwoof »

Flash wrote:
rufwoof wrote:On mine, starting a new instance or starting a new window doesn't seem to make any difference as to how much additional ram is used.
It may depend on the browser you're using. I use SeaMonkey. Mike Walsh uses Chrome.
I'm running iridium - a chrome derivative. Chrome has better security (process/privilege separation, with around 6 or 7 processes and tasks appropriately allocated within that, FF (of which seamonkey is a derivative) use just two)). Under OpenBSD (that I run), chrome is Pledged i.e. the code has been adapted so that it better ensures the browser stays within what it is expected to do/access. From a usage angle that is more annoying as you can get the Aw-Snap "crash" relatively often depending upon what web sites you visit (yahoo news is common aw-snap, reload culprit). Of the two, the FF code is more entangled/complex, so I wouldn't be surprised if additional instances involved eating more memory. Under OBSD FF hasn't been Pledged as of yet due to the code complexities, whereas for chrome Pledging was relatively quick/simple. Chrome -> Chromium -> Iridium ... in effect reduces the amount of google data gathering (OBSD adds to that by refining the code to make it more secure). Lean/simpler code often leads to less/better memory utilisation. I most certainly do notice much better response times when using google services such as googledocs under iridium compared to FF - but wouldn't be surprised if that was a server side intentional thing - for instance I believe if you try to access googledocs using IE it will prompt you to use another 'better' browser (inhibiting the competition to promote their own).

To add to what has gone before

to free pagecache ...
echo 1 > /proc/sys/vm/drop_caches

to free inodes ...
echo 2 > /proc/sys/vm/drop_caches

to free pagecache and inodes:
echo 3 > /proc/sys/vm/drop_caches

to clear swap
swapoff -a && swapon -a

... so as a single line script type action the OP might perhaps want to run something like

#!/bin/sh
echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#16 Post by rufwoof »

ITSMERSH wrote:
22 browsers tabs
:shock:
May be you should get a hobby in real life? :wink:
22 does seem somewhat excessive - but each to their own. Predominately I run one session cli/root using tmux for multiple windows (tabs set to be at the top of screen), and another browser as desktop, running as user ... type setup. That way the hardware and personal docs/data (root) are isolated from the X/browser (user) session. Nowadays a browser/online services can pretty much do all the things I do/use, calculator, text editing, image editing, docs/spreadsheets, mail/calendar, music/video player ....etc. Such that I can ctrl-alt-Fn between the root/cli/tmux (with multiple tabs) and browser (maximised, with multiple tabs). Used in such a manner and two or even three browser sessions, each with multiple tabs ... isn't that uncommon - as that is a form of 'multiple-desktops' with multiple-activities/tasks running on each.

I've also transitioned over from using a gui document editor (LibreOffice) to simply creating/editing documents using raw html (browser can be used to view/spell-check and the print to PDF file those html documents). Pretty much just base OpenBSD (that includes X, window manager, http server, mail server ...etc. as part of the base system, that is intensively security audited as a whole), with a browser (Iridium in my case) on top of that. And where the browser is in effect the desktops/windows (gui). Pretty rare however for me to have even 15 'windows' (browser tabs) 'open' (3 browser sessions, 5 tabs each). More often its a case of 1 browser session, up to a handful of tabs.
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
souleau
Posts: 148
Joined: Sun 23 Oct 2016, 15:24

#17 Post by souleau »

mcewanw made this shell script years ago called freeupram, and it works great for me.
I don't know how it behaves on modern puppies though.

Here's the link:

http://www.murga-linux.com/puppy/viewto ... 596#356501

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

#18 Post by mikeslr »

Hi souleau,

Examination of mcewanw's script reveals that it is exactly the same as that nic007 provided earlier on this thread.

Maybe the thing to do is to create a desktop file which calls it. Then you could add it to the panel/taskbar.

Sorry, don't have the time to prepare it right now. But all you would need is a named /usr/share/desktop file, using the script after Exec=; a line providing "No Display" if you didn't want it to appear on the Start Menu, an icon somewhere (e.g. /usr/share/icons) with the desktop Icon's argument being Icon=pathToIcon/nameOfIcon.png? and an argument Category=Utility.

mikesLr

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#19 Post by greengeek »

In many cases the problem with RAM usage by the browser is not so much a case of how MUCH ram the browser needs to run, it is a case of misuse of that ram, and ram leaks of some kind, causing the cpu usage to get clagged.

I often find even simple sites cause my Chrome 48 to go into some form of "runaway" when those sites have certain types of adverts spread around the screen. The browser process heats up the machine, stops other processes running and often fails completely.

Someone released a version of Palemoon that locked out many of the advertising sites and it works really well in cases where Chrome gets it's knickers in a knot. I can browse much much faster with that version of Palemoon than I can with Chrome (especially on Trademe.co.nz). Sometimes the problem is bad browser code and excessive adverts or bad video codecs rather than actually running out of RAM.

I really doubt that a machine with 4GB of ram should have any genuine issue with inadequate ram - the real issue is coding faults or bad privacy settings in the browser.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

Re: I FOUND THE PROBLEM

#20 Post by greengeek »

pp4mnklinux wrote:I found that the problem is not the RAM, but a scrip which hang on the computer.

I send two screens, hosted at google drive


https://photos.google.com/photo/AF1QipO ... E4BAAmkS6V


https://photos.google.com/photo/AF1QipM ... Sp17lwyop5


thanky
I tried to view these but it seems to require signing into a Google account. I could not find a way to view these.

Post Reply