internal fragmentation

a personal journal of hacking, science, and technology

Gnote vs Tomboy memory showdown with smem

Wed, 11 Nov 2009 13:47 in / link / 7 comments

As an illustration of my recent release of smem 0.9, here's how Gnome desktop rivals Gnote and Tomboy compare on memory usage.

Methodology: take a normal GNOME desktop and add either Gnote or Tomboy to a panel. Restart X, open a single terminal window, take a process size measurement, open up the "Search All Notes" window, take another process size measurement, then measure libary sizes.

Here's what the output for a freshly-started Gnote looks like:

# smem -P gnot*e -t
  PID User     Command                         Swap      USS      PSS      RSS 
 8552 mpm      /usr/bin/gnote --panel-appl        0    13652    14915    23896 
-------------------------------------------------------------------------------
   87 1                                           0    13652    14915    23896 

'RSS' (resident set size) is the measure reported by most tools, and shows 23.8MiB of memory usage by Gnote. But that number is misleading as it counts all the memory used by numerous shared libraries (Gnote uses about 170 shared mappings). In fact, most developers (rightly) ignore this number as meaningless and (not so rightly) assume that the bulk of memory usage is shared.

If we compare running Gnote and not running Gnote, we'll see a much smaller difference in memory usage. In fact, the difference we'll see is in the table above as 'USS' (unique set size). There's 13.6MiB of memory that's used only by Gnote. The remaining 10.2MiB is shared with other applications. 'PSS' (proportional set size) accounts for that difference by dividing up shared ownership of libraries on a page by page basis. If you add up the PSS of all the processes on the system, they will sum to the total (userspace) memory usage.

So, Gnote's real share of memory is 14.9MiB, once sharing is accounted for. Fairly expensive for having only drawn a 32x32 icon so far. Hell, that's fairly expensive for a full-featured GUI environment and wordprocessor by mid-'90s standards, but I digress.

Now let's look at a freshly-started Tomboy:

# smem -P tom*boy -t
  PID User     Command                         Swap      USS      PSS      RSS 
 7873 mpm      bash /usr/bin/tomboy-panel         0      464      652     1612 
 7885 mpm      mono /usr/lib/tomboy/Tomboy        0    21732    22618    31116 
-------------------------------------------------------------------------------
   89 1                                           0    22196    23270    32728 

First note that Tomboy here is getting launched by an extra persistent copy of bash that chews up an extra 652KiB of memory. But the numbers for the main process are all larger also (by about 8MiB, 7.7MiB, and 7.2MiB respectively). 6.9MiB of that is 21 Mono libraries that are only used by Tomboy (at least on my desktop):

$ smem -m -M mono -t
Map                                       PIDs   AVGPSS      PSS 
/dev/shm/mono.9295                           1        4        4 
/usr/lib/mono/gac/NDesk.DBus.GLib/1.0.0.     1        8        8 
/usr/lib/mono/gac/gconf-sharp/2.24.0.0__     1       12       12 
/usr/lib/mono/gac/gnome-panel-sharp/2.24     1       16       16 
/usr/lib/mono/gtk-sharp-2.0/libglibsharp     1       16       16 
/usr/lib/mono/gtk-sharp-2.0/libgdksharpg     1       24       24 
/usr/lib/mono/gac/gmime-sharp/2.2.0.0__2     1       48       48 
/usr/lib/mono/gac/atk-sharp/2.12.0.0__35     1       56       56 
/usr/lib/mono/gac/pango-sharp/2.12.0.0__     1       60       60 
/usr/lib/mono/gac/NDesk.DBus/1.0.0.0__f6     1       72       72 
/usr/lib/mono/gac/glib-sharp/2.12.0.0__3     1       84       84 
/usr/lib/mono/gtk-sharp-2.0/libgtksharpg     1       92       92 
/usr/lib/mono/gac/gnome-sharp/2.24.0.0__     1      140      140 
/usr/lib/mono/gac/Mono.Posix/2.0.0.0__07     1      172      172 
/usr/lib/mono/gac/Mono.Addins/0.4.0.0__0     1      180      180 
/usr/lib/mono/gac/gdk-sharp/2.12.0.0__35     1      180      180 
/usr/lib/mono/gac/System/2.0.0.0__b77a5c     1      644      644 
/usr/lib/mono/gac/System.Xml/2.0.0.0__b7     1      652      652 
/usr/lib/mono/gac/gtk-sharp/2.12.0.0__35     1     1116     1116 
/usr/bin/mono                                1     1648     1648 
/usr/lib/mono/2.0/mscorlib.dll               1     1660     1660 
-----------------------------------------------------------------
21                                          21     6884     6884 
Here's the PSS numbers including firing up search:
ToolStartupSearch
Gnote1491516929
Tomboy2327027197

Conclusion? They're both hopeless bloated, but Tomboy considerably more so. Next up: gweather, which takes 5MiB to tell me I should be outside enjoying the sunshine.

LOL, the best part about gweather is that it's always telling you it's sunny. at least here in Cambridge (UK) the reported weather is always wrong.

you are completely right. I always hated software bloat. I can understand a process taking 200mb of memory if it's essential to your business. that's why I don't mind stuff like GTK, QT and .NET where properly used. but when you need 14mb just to load a bunch of notes from the hard drive you know there's something wrong.

BTW, I love http://tinyapps.org/ when it comes to windows applications. it's a pity there's no equivalent for linux apps :(
David @ Thu Nov 12 18:07:54 2009
"it's a pity there's no equivalent for linux apps :("

LIES! http://suckless.org/ has you covered.
scythe @ Thu Nov 12 20:25:01 2009
I did a quick test of Gedit vs. Emacs (gedit-2.26.3-1.fc11.i586 and emacs-23.1-5.fc11.i586). I started each from the command line, opening the same small text file in each. This is in a GNOME session with Firefox and nothing else running. The PSS numbers were:

Gedit 10.1 MB
Emacs 12.7 MB (no .emacs file)
Emacs 15.3 MB (my usual .emacs file)

So, Emacs, which is running its own Lisp interpreter, has enough features to be called an operating system unto itself and used to be the epitome of bloat, with a text file open in it takes up less space than Gnote.
Mike @ Thu Nov 12 20:43:17 2009
That's why one should always avoid VM-based desktop software: because you'll be running X copies of JVM/Mono/Python/Ruby runtimes for X processes. Sure Tomboy is pretty lame since it's a Mono program, but for a more dramatic effect you could have measured printer management tools that are included in Ubuntu by default and written in Python: not only they do a lot less than Tomboy, but there are also two or three of them running at the same time, keeping several copies of Python runtime/VM in RAM.
Eugueny Kontsevoy @ Thu Nov 12 21:22:10 2009
Windows NT4 SP1 takes 12MB ram after setup :P...though sp6a already needs around 90MB of ram.

Howewer, I also believe that software has to become more simple regarding the libraries etc...I'm not a big fan of the "Rebol" programming language but at least you can do a lot of stuff including gui development and the executable is just 600kbyte and available for linux, windows, os-x, openbsd, ...

Just my thoughts.
Andreas Schipplock @ Fri Nov 13 02:51:21 2009
> Conclusion? They're both hopeless bloated, but Tomboy considerably more so.

Does it really matter in an age where four gigabyte laptops are fairly easy to come by?
James Aguilar @ Mon Nov 16 16:33:10 2009
James: Yes it does matter.
My Thinkpad laptop (the main machine I use) has 768MB memory, and may be expanded only up to 2GB (but 1GB DDR so-dimm are quite expensive, unlike DDR2)
Pascal Terjan @ Tue Nov 17 03:43:41 2009

Name:


E-mail:


URL:


Comment: