Choose style:

Author Topic: Free Memory bleeding in P 8(SOLVED)  (Read 288 times)

0 Members and 1 Guest are viewing this topic.

Offline alynur

  • Trusted User
  • Member
  • *****
  • Posts: 415
  • Karma: 11
  • New Forum User
    • View Profile
  • Peppermint version(s): 8
Free Memory bleeding in P 8(SOLVED)
« on: November 19, 2017, 07:46:42 pm »
Hello peppermint people. I need help with a problem I have and apparently have had for a while. Something is bleeding system free memory to the point that it gets down to 2% on Psensor's scale and causes whichever browser I'm using to become sluggish. I thought it was a browser issue and had switched over time from Chromium to Chrome to Firefox. All the browsers act the same, none of them affect the memory bleed.  Below are pics of Psensor graphs showing the bleed off over a couple of hours. These graphs also represent just the system turned on, no browsers open.

 



Also, this doesn't happen in either of the other Linux distros I have installed in this computer so I'm confident it is not a hardware problem. This only happens in P 8.
I ran top and htop and neither showed anything using 40% of memory. So I am wondering what else I can do to find the culprit? That memory is getting chewed up by something, would be nice to find it and pull it's teeth. Any help would be appreciated, thanks guys   :)
« Last Edit: December 06, 2017, 01:05:51 pm by alynur »

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 18047
  • Karma: 2148
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8 (64bit)
Re: Free Memory bleeding in P 8
« Reply #1 on: November 20, 2017, 10:05:50 am »
Okay I'm not seeing a memory leak....

This was with both chromium-browser with 3 tabs and firefox with 12 tabs open.


And it stayed steady at 77-78% free memory.

Maybe you should start top running with the %MEM field selected (top memory using processes), then watch for what process rises slowly to the top over time.
Code: [Select]
top -o %MEM
« Last Edit: November 20, 2017, 10:15:14 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline alynur

  • Trusted User
  • Member
  • *****
  • Posts: 415
  • Karma: 11
  • New Forum User
    • View Profile
  • Peppermint version(s): 8
Re: Free Memory bleeding in P 8
« Reply #2 on: November 20, 2017, 01:29:56 pm »
Hi PCNetSpec,here are the results of an hour of the computer turned on and no browsers open;

 

And here is the Top memory list at the end of the hour, this was also open for the entire hour but never showed anything out of the ordinary.


Offline VinDSL

  • Global Moderator
  • Hero
  • *****
  • Posts: 3349
  • Karma: 660
  • Peppermint Mod
    • View Profile
Re: Free Memory bleeding in P 8
« Reply #3 on: November 20, 2017, 01:39:53 pm »
Finding mem leaks takes a while. Sometimes they happen quickly, and sometimes slowly. Yours is happening pretty fast, so it shouldn't be too hard to find.

As an aside, I found and fixed a mem leak in a popular Conky Lua script, some years ago. The Conky community had been working on a fix for over a year. Turned out to be improper garbage collection. Took about a month to figure out the source of the problem and patch it.

Here's the changlog:

Code: [Select]
Changelog:
+ v3.1 VinDSL Hack (12.01.2011) Added more shading example(s).
+ v3.0 VinDSL Hack (01.28.2011) Killed memory leak.
+ v2.4 VinDSL Hack (01.25.2011) Declared all variables in local.
+ v2.3 VinDSL Hack (12.31.2010) Added shading example(s).
+ v2.2 VinDSL Hack (12.30.2010) Cleaned up the code a bit.
+ v2.1 VinDSL Hack (12.24.2010) Added cairo destroy function(s).
+ v2.0 VinDSL Hack (12.21.2010) Added height adjustment variable.
+ v1.0 Original release (07.10.2009)

In your situation, assuming you're booting your machine, and leaving it idling at the desktop, I would SIGKILL processes one at a time, and see which one is causing it - then, of course, try to find a fix or workaround.

Happy hunting.  :)

Offline VinDSL

  • Global Moderator
  • Hero
  • *****
  • Posts: 3349
  • Karma: 660
  • Peppermint Mod
    • View Profile
Re: Free Memory bleeding in P 8
« Reply #4 on: November 20, 2017, 02:38:06 pm »
Had to run for a minute. Okay, back on topic...

Personally, when I'm checking mem, all I care about is 'RES MEM'.

Looking at your graphic above, Skype and DropBox raises red flags for me, and 'my-weather', whatever that is.

I'd try killing them - I'm assuming they're being autostart'ed at boot - and see if that makes a diff.  ;)
« Last Edit: November 20, 2017, 02:43:13 pm by VinDSL, Reason: Addendum »


Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 18047
  • Karma: 2148
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8 (64bit)
Re: Free Memory bleeding in P 8
« Reply #5 on: November 20, 2017, 03:43:29 pm »
See if this frees the memory:
Code: [Select]
sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
?
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline alynur

  • Trusted User
  • Member
  • *****
  • Posts: 415
  • Karma: 11
  • New Forum User
    • View Profile
  • Peppermint version(s): 8
Re: Free Memory bleeding in P 8
« Reply #6 on: November 22, 2017, 11:01:33 am »
See if this frees the memory:
Code: [Select]
sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
?

That recouped about 30% from where I was, depending on when I run it, but it doesn't stop the bleed.  Would I have to run this command every time the memory gets down low?

So how do I run SIGKILL to a process and is it okay to run it on any of the processes listed in the Top memory list?

By quitting Dropbox right after startup, the memory bleed bottomed out at 29% with Chrome open and 5 tabs. Killing Skype would defeat part of my reason for being on the computer but even when I do quit Skype at startup the bleed continues down to around 36% free memory. Maybe browser performance will be okay with the free memory above 20%, I'm not sure yet. Next on the list to kill will be my-weather-indicator.


Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 18047
  • Karma: 2148
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8 (64bit)
Re: Free Memory bleeding in P 8
« Reply #7 on: November 22, 2017, 11:26:41 am »
The point is to see if the free memory still continues to fall (without you doing anything on the computer) with dropbox and skype NOT running .. so you can nail (or not) it down to one of those apps.

You're going to need to stop both of those apps, start psensor .. then leave the PC alone for about an hour .. and see if the free memory is gradually falling even though you're not doing anything.
« Last Edit: November 22, 2017, 11:33:55 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline alynur

  • Trusted User
  • Member
  • *****
  • Posts: 415
  • Karma: 11
  • New Forum User
    • View Profile
  • Peppermint version(s): 8
Re: Free Memory bleeding in P 8
« Reply #8 on: November 22, 2017, 08:59:17 pm »
The point is to see if the free memory still continues to fall (without you doing anything on the computer) with dropbox and skype NOT running .. so you can nail (or not) it down to one of those apps.

You're going to need to stop both of those apps, start psensor .. then leave the PC alone for about an hour .. and see if the free memory is gradually falling even though you're not doing anything.

I had tried that, with Dropbox and Skype closed, the memory bottomed out at around 36%.  So the next test would be to include my-weather-indicator and see how low it goes.  Then i would like to try VinDSL's suggestion, but I don't know how.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 18047
  • Karma: 2148
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8 (64bit)
Re: Free Memory bleeding in P 8
« Reply #9 on: November 22, 2017, 10:27:10 pm »
It's not about how low it goes, it's about if it continues to fall until you run out of memory .. if it bottoms out it's not a memory leak, it's just a heavy or inefficient app.

Something else that **may** be indicative of a memory leak but not always, is that closing the app doesn't necessarily release the memory back to the system.
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec


Offline VinDSL

  • Global Moderator
  • Hero
  • *****
  • Posts: 3349
  • Karma: 660
  • Peppermint Mod
    • View Profile
Re: Free Memory bleeding in P 8
« Reply #10 on: November 23, 2017, 10:52:18 am »
The next test would be to include my-weather-indicator and see how low it goes.  Then i would like to try VinDSL's suggestion, but I don't know how.

Like 'all things Linux' there are different ways to do it - from CLI and/or a GUI, like 'Task Manager', et cetera.

The idea is to I.D. the process, kill it, and monitor the affect(s).

Somebody just posted an omnibus overview about why distro hopping isn't good, and the vid producer touched on it, for a moment, starting here:

Spoiler (click here to view / hide)

Maybe that will give you the general idea - picture being worth 1000 words.

Just be careful what you kill. The vid producer touched on the dangers of killing a sqldb, for instance, but you probably don't need to worry about that, unless you're running a LAMP stack. However, if you have some work that isn't saved, in some app that you're using, it entirely possible that you can kill the wrong process and it will spit you out of the session into the login screen, or even reboot your machine without warning.

That's why I don't to get too explicit about stuff like this...  ;)
« Last Edit: November 23, 2017, 12:11:11 pm by VinDSL, Reason: Addendum »

Offline alynur

  • Trusted User
  • Member
  • *****
  • Posts: 415
  • Karma: 11
  • New Forum User
    • View Profile
  • Peppermint version(s): 8
Re: Free Memory bleeding in P 8
« Reply #11 on: November 27, 2017, 11:03:37 pm »
Okay, this looked like it was going to be a little too complicated for me to resolve so I went ahead and performed a fresh install. I'm not going to perform a Timeshift restore or an Aptik restore because I don't want to reinstall whatever was causing all the problems. I've got the majority of the programs I use installed and so far things are looking pretty good. If I come across something that's causing this memory bleed, I'll report back here. Thanks for all the help guys.  :)

Offline alynur

  • Trusted User
  • Member
  • *****
  • Posts: 415
  • Karma: 11
  • New Forum User
    • View Profile
  • Peppermint version(s): 8
Re: Free Memory bleeding in P 8
« Reply #12 on: December 05, 2017, 04:05:09 pm »
So I was wondering how can I run the command PCNetSPec supplied, i.e.
Code: [Select]
sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
every half hour or at least every hour as a scheduled task? I think gnome-schedule(Scheduled tasks?) can do that type of thing but I have no idea.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 18047
  • Karma: 2148
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8 (64bit)
Re: Free Memory bleeding in P 8
« Reply #13 on: December 05, 2017, 07:38:47 pm »
Hope you're comfortable with nano ?

If so, run:
Code: [Select]
sudo crontab -e
(be SURE to use 'sudo' in the above command)

Move your cursor to the bottom (with the down arrow key) and add a new line.

Make the new line read:-
Code: [Select]
0,30 *  * * * sync && echo 3 | tee /proc/sys/vm/drop_caches
Or if you want it to run every 15 mins instead:-
Code: [Select]
0,15,30,45 *  * * * sync && echo 3 | tee /proc/sys/vm/drop_caches
and in either case, it's a good idea to add a new empty line underneath the line you just added.

Once you've added the line, and a hit enter to add a blank line underneath it, hit Ctrl+X .. then Y .. then Enter (to SAVE and close) .. you should see a message:-
"crontab: installing new crontab"
(and no other error messages)

That command should run every time the clock hits the hour, and half past the hour.



You can check if the cron job ran by grepping the syslog for entries thaat contain "CRON"
Code: [Select]
grep CRON /var/log/syslog
but obviously only after 00 or 30 has come around, because there won't be any entries until then.
« Last Edit: December 05, 2017, 07:54:37 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline alynur

  • Trusted User
  • Member
  • *****
  • Posts: 415
  • Karma: 11
  • New Forum User
    • View Profile
  • Peppermint version(s): 8
Re: Free Memory bleeding in P 8
« Reply #14 on: December 06, 2017, 01:05:04 pm »
Excellent! This works great, keeping my free memory above 55%. Thanks again.  :)