After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 620196 - gnome-terminal scrollback leak
gnome-terminal scrollback leak
Status: RESOLVED NOTABUG
Product: gnome-terminal
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-05-31 23:00 UTC by Gianfranco Costamagna
Modified: 2010-06-03 19:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
output of G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind -v --tool=memcheck --leak-check=full --num-callers=40 --log-file=valgrind.log gnome-terminal (529.64 KB, text/plain)
2010-06-03 18:32 UTC, Gianfranco Costamagna
Details

Description Gianfranco Costamagna 2010-05-31 23:00:59 UTC
this is a foward of bug https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/243596 since it happens to me too

please ask if you need more information
Comment 1 Gianfranco Costamagna 2010-05-31 23:01:32 UTC
open system monitor
open a gnome-terminal, Edit the current profile's scrollback lines to the maximum value allowed. - 100000 lines.

type this in the terminal...
 ls / -R

Notice the memory gnome-terminal, Once this is finished, open a new tab, and close the tab you ran "ls / -R" in
Notice the memory gnome-terminal uses does NOT go down.

run "ls / -R" again and see the memory goes up again.
I have had the memory level of gnome terminal go up to 1.7gig.
Comment 2 Christian Persch 2010-05-31 23:37:40 UTC
100000 is not the maximum; it was the maximum in an old gnome-terminal version. Please try 2.30.x.
Comment 3 Behdad Esfahbod 2010-05-31 23:41:35 UTC
With latest stable g-t, the process size does not grow *at all* when you do "ls -R /".
Comment 4 Behdad Esfahbod 2010-05-31 23:46:11 UTC
What was the original "leaks CancelOk" thing about?

Read the downstream bug, indeed it's only happening with old g-t.
Comment 5 Gianfranco Costamagna 2010-06-01 06:17:45 UTC
NO. Read the downstream bug (In reply to comment #4)
> What was the original "leaks CancelOk" thing about?
> 
> Read the downstream bug, indeed it's only happening with old g-t.

It happens with g-t 2.30.1 and I setted the scroll to illimited

(CancelOk were a bad copy from lp)
Comment 6 Behdad Esfahbod 2010-06-01 17:23:04 UTC
Take the time to explain what happens with 2.30.1 please then.
Comment 7 Gianfranco Costamagna 2010-06-03 16:26:50 UTC
amd64 architecture.
Installed gnome-terminal 2.30.1 from maverick repository

in the profile check "unlimited" scrolling (the same is with scrolling = 2147483647)

type ls / -R

I have before 1.4 gib of ram used (37.1%)



memory increase to 1.7Gib (44.8%)



close the terminal

memory is _STILL_ 1.7 Gib
Comment 8 Behdad Esfahbod 2010-06-03 16:32:23 UTC
You have your /tmp mounted as tmpfs, don't you?
Comment 9 Gianfranco Costamagna 2010-06-03 16:35:58 UTC
nope

/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
/dev/sda2 on /home type ext4 (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/locutus/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=locutus)
Comment 10 Christian Persch 2010-06-03 16:38:32 UTC
What memory are you measuring, btw? I rather doubt that gnome-terminal uses 1.4 GB of memory right after you started it...
Comment 11 Behdad Esfahbod 2010-06-03 16:39:26 UTC
I suspect you are counting kernel's disk caches as "memory usage" also...
Comment 12 Gianfranco Costamagna 2010-06-03 16:42:19 UTC
1.4 is the global memory used, the 300mb increase is of gnome-terminal.

I show the kernel cache also, how can I show only the memory usage?
Comment 13 Behdad Esfahbod 2010-06-03 16:43:39 UTC
That's expected, and not a bug.  Please don't reopen.
Comment 14 Gianfranco Costamagna 2010-06-03 16:44:35 UTC
I want only ask you a little question, to be sure of this, how can I only check the memory usage?
Comment 15 Behdad Esfahbod 2010-06-03 16:46:35 UTC
You still haven't told us how you are checking memory usage...

If you are using top, subtract buffers and cached.
Comment 16 Gianfranco Costamagna 2010-06-03 17:00:31 UTC
from top
 3616 locutus   20   0  315m  18m  12m S    3  0.5   0:
03.77 gnome-terminal                                                                          
Mem:   3893752k total,  3741244k used,   152508k free,   313116k buffers
Swap:  1044188k total,        0k used,  1044188k free,  1609224k cached

total mem - cached = 2132020
                  
after the command
 3616 locutus   20   0  317m  20m  12m S    3  0.5   0:20.31 gnome-terminal                                                                                            
Mem:   3893752k total,  3810728k used,    83024k free,   501160k buffers
Swap:  1044188k total,      172k used,  1044016k free,  1306608k cached

total mem - cached = 2587144

after gnome-terminal were closed
Mem:   3893752k total,  3776428k used,   117324k free,   501292k buffers
Swap:  1044188k total,      172k used,  1044016k free,  1280568k cached

total mem - cached = 2495860

so there seems to be a little memory leak
Comment 17 Gianfranco Costamagna 2010-06-03 17:03:01 UTC
without buffers
1818904
2085984
1994568
Comment 18 André Klapper 2010-06-03 17:26:44 UTC
Feel free to run valgrind to find it.
Comment 19 Gianfranco Costamagna 2010-06-03 18:32:04 UTC
Created attachment 162681 [details]
output of G_SLICE=always-malloc G_DEBUG=gc-friendly  valgrind -v --tool=memcheck --leak-check=full --num-callers=40 --log-file=valgrind.log gnome-terminal

This is the output from valgrind
Comment 20 Christian Persch 2010-06-03 18:36:40 UTC
Just the usual pango/freetype/gtype things, no unexpected nor any huge mem leaks in this valgrind run:

==21859==    definitely lost: 8,453 bytes in 24 blocks
==21859==    indirectly lost: 24,812 bytes in 804 blocks
==21859==      possibly lost: 38,202 bytes in 569 blocks
Comment 21 Gianfranco Costamagna 2010-06-03 18:38:40 UTC
So, this seems to be only a cache problem (the cache amount is added to the total amount of free ram), Marking as obsolete.

Thanks to everybody for your time
Comment 22 Behdad Esfahbod 2010-06-03 19:11:21 UTC
Just stop playing with the bug status please.