Caja Memory Leak?

I noticed recently that caja has been gradually consuming more memory. When the caja process is started (e.g. system startup, restarting the process, etc.), it uses ~100 MB. However, after startup the RAM usage begins creeping up. It happens at different rates, but a pretty typical example is ~0.5-1 MB/min. This continues, and eventually, will occupy almost 25% of the memory on my system (1.9 GB is the highest I have seen). The only thing I have been able to find to stop this is killing the caja process.

This increasing memory usage happens regardless of whether or not there are any actual caja windows open (although it does seem to happen faster when there are windows), and regardless of the number or type of files in the directory if a caja window is open.

I was originally going to post a bug report on GitHub but figured I should post here first to make sure this isn’t already a solved issue.

System Information:
Ubuntu MATE 17.10 (64-bit)
Kernel version: 4.13.0.38-generic
mate-desktop 1.18.0-1
caja 1.18.4-0ubuntu2

Maybe bad install? I'm a Strong proponent of
"If it seems broken
Re-Install because it is Linux"
v17.10

I have this in my .bash_aliases
Alias Code:

alias mem='free -mt; grep MemTotal /proc/meminfo;vmstat;ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head; ps -eo pid,comm,%cpu | sort -rk 3 | head' #Top Ten

Mem

[details=Summary]              total        used        free      shared  buff/cache   available
Mem:          16037       11246        1290        1015        3501        4393
Swap:          5499           0        5499
Total:        21537       11246        6790
MemTotal:       16422716 kB
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 1320624 797112 2788332    0    0    19    14   10    2 14  3 83  0  0
  PID  PPID CMD                         %MEM %CPU
23730 23724 /usr/lib/chromium-browser/c  7.5  4.5
20095     1 qbittorrent                  3.9  2.1
 8576  8521 /run/firejail/appimage/.app  3.0 33.9
23795 23730 /usr/lib/chromium-browser/c  3.0  0.0
 3760  3750 mpv --player-operation-mode  2.9  8.6
 8636  8521 /run/firejail/appimage/.app  2.5  2.3
21160 21096 /usr/lib/firefox/firefox -c  2.4  0.0
26818 26808 mpv --player-operation-mode  2.2  1.3
21096 21095 /usr/lib/firefox/firefox -n  2.2  0.1
27760 mate- <defunct>  0.7
  PID COMMAND         %CPU
22525 Web Content      0.8
22792 Web Content      0.0
21160 Web Content      0.0
 1822 pulseaudio       8.6
 3760 mpv              8.6
 8503 rambox           7.8
27585 chromium-browse  7.3
27665 chromium-browse  6.6[/details]

No Caja in my top ten...
when you break Linux you can fix it real easy.
re-install then play with it again!

you can look up installing Linux with "Something else"
you will find a few How to's

I set mine up like this (Close to this
this is a good place to START)

Hard Drive Partitions
512mb Primary - Ext4 Filesystem - /Boot
30720mb (30Gig) Primary - Ext4 Filesystem - /
8192mb (8Gig) Primary - Swap area (Make Swap same as amount of RAM if 8 or less only 2or3 Gig for more Ram)
Primary -Ext4 - /home


/swap not required by newer Boxes from what I understand

With it set up like this you can re-format Everything except your /home Directory and have a Band New OS without Loosing any important data.
You can re-install what MATE doesn't or can't and you have a Brand New System without sweating a Drop.

I Do Back up Everything important with Aptik

Good Luck and have Fun!

2 Likes

Hi @tbirdc1212,

try changing your software sources download location to somewhere else and updating again, I use the “Main Server” myself, if yours is set to your country, try changing it to “Main” per the update guide linked below. :smiley:

1 Like

A while back I got hit with a hard to diagnose memory leak.

Eventually, I reported it upstream @ https://github.com/mate-desktop/mate-panel/issues/479

Maybe you will find something useful in these threads to investigate further?

1 Like

First and foremost, thank you all for the quick response! :smiley:

Blank, I agree that often the solution comes down to a reinstall. Thank you for your helpful suggestions. When caja is initially started, it definitely does not make the top 10 of processes based on memory usage. It's when the caja process has been running for a significant amount of time (e.g. hours of idle time, several days across sleep/wake cycles, etc.) that it begins consuming a significant amount of memory. I'd like to save a system reinstall as my last option because my computer is LUKS encrypted and maintaining my user data while reinstalling the system would be a hassle in that setup. That being said, I will definitely consider that option and I appreciate you bringing it up.

@wolfman thank you for the suggestion about changing software sources. The repository was set to the US server, so I changed it to Main and reinstalled all the caja packages present on my system and logged out/logged in again. As of right now, it seems like the problem is still persisting. Thank you for the suggestion!

@ouroumov I thought the same thing when I noticed the memory usage. If there are no other solutions presented, I was planning to file a bug. I am new to the Ubuntu MATE community, so I was wondering if the standard operating procedure was to file the bug at the upstreatm MATE GitHub or the Ubuntu MATE GitHub first?

I posted the output of a ps script monitoring the caja program below (based on this great StackOverflow post: https://stackoverflow.com/questions/7998302/graphing-a-processs-memory-usage?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) graphed as % of memory used (right axis) and virtual memory size (left axis, very large scale so the change looks small). This was immediately after restarting the caja process with no caja windows open after ~3 hrs.

Please report this bug on launchpad first (with the command ubuntu-bug caja) and attach the plotting script and this plot to your report.
Please also indicate whatever caja customizations you have that you think might be relevant (desktop icons to show set in MATE Tweak, default view, background image, remote filesystem shares, caja pluggins, etc…) or if you haven’t customized caja at all mention it.
I will then attempt to reproduce on my machine, since I happen to be using the same versions of the OS / packages.
FYI, after 5 days of uptime my caja memory usage is still only 88MB currently.

1 Like

@tbirdc1212 I’d like to see the StackOverflow post that you mention

Thanks,
Jeff

1 Like

I edited my original post to include the link (https://stackoverflow.com/questions/7998302/graphing-a-processs-memory-usage?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa)

Thank you for bringing it up @stone1343!

Thank you very much for the help @ouroumov, I filed the bug in Launchpad: https://bugs.launchpad.net/ubuntu/+source/caja/+bug/1764727

1 Like

Thank you, I have launched an attempt to reproduce and will post results later.

1 Like

This is an old thread but since it's probably the same issue, I'll post here. I used Caja quite a lot in my session to copy and delete files and folders and it turns out that Caja is now consuming way more ram memory than it does when the system boots, it's using 290 MB:

Is this normal or is this the result of a memory leak?

It might well be a memory leak. I just checked and my Caja was taking ~ 530 MB. After restarting it (caja -q), it takes ~85 MB.

It’s also possible that it is by design and Caja just keeps cached data to speed things up, as memory usage grows when generating thumbnails e.g., but the memory consumption seems big for his (especially in the case of OP with 2 GB taken). Also, thumbnails are already cached on disk, not sure if there’s a reason to do it also in RAM.