February 21st, 2009

Vidar is a fairly geeky guy who enjoys writing and using nifty software. He hopes this blog will present new niftyness to you, the adoring fans.

  1. June 9th, 2009 at 15:32 | #1


    I represent a company for which I do some technical blogging for. I’ve stumbled upon your LINUX ATE MY RAM! page from the social networking sphere, and thought I’d ask permission to blog about this and link to your site.

    I’ve encountered newbies hitting the same roadblock, wanted to explain the common misunderstanding and link to your site at the bottom of my blog post.

    Is that okay with you?

    - Jon

  2. Vidar
    June 10th, 2009 at 05:50 | #2

    @ Jon
    Absolutely! Anything that increases awareness of the wonders of disk cache has my support.

  3. February 23rd, 2010 at 20:08 | #3

    Hi. Thx for your program : http://www.vidarholen.net/contents/junk/mandel.html
    I have tried to run it. After make I have :
    adam@adam-laptop:~/mandel_c_mthread/mandel$ make
    gcc -O9 -o mandel mandel.c -lpthread -lm -g -std=c99 -Wall -Werror
    cc1: warnings being treated as errors
    mandel.c: In function ‘calc_pixel’:
    mandel.c:292: error: ‘drgb’ may be used uninitialized in this function
    make: *** [mandel] Błąd 1
    Can you help with it ?
    Best regards


  4. Vidar
    February 24th, 2010 at 06:36 | #4

    @ Adam
    My gcc 4.3.4-6 from debian doesn’t complain, but yours is right. Try simply editing the makefile and removing the word “-Werror” on line 4. Does that help?

  5. February 25th, 2010 at 16:05 | #5

    Yes. It works fine. I have AMD turion 64 X2 and Ubuntu 64-bit and 2 GB RAM. What number of threads should I use ?

  6. Vidar
    February 25th, 2010 at 17:56 | #6

    @ Adam
    2 should be fine.

  7. February 25th, 2010 at 19:26 | #7

    You are right. ( Why you use -j 3 ? ).
    I have changed one function
    and it works 2 time faster.

  8. January 29th, 2013 at 16:29 | #8

    Hi Vidar,
    Congrats for your blog! I’ve been reading your “linux ate my ram” mini-blog :-) Everythin ok, but I have one question. I have a server with 4GB ram, and memory monitored. I’ve observed that it always have enough memory (+/- buffers/cache line) with some graphs, but there are certain moments that the OS has needed a bit of swapping (only a few megs) but the free memory is always high. I’m pretty sure cause I generate memory graphs, and the amount of free memory is always high. What do you think about it?

  9. Vidar
    January 29th, 2013 at 20:09 | #9

    The kernel can be configured to swap out unused applications to make room for more disk cache to speed up applications in use. The degree to which this is done is called ‘swappiness’, configurable in /proc/sys/vm/swappiness.

    If swappiness is 0, the kernel will never swap out unused apps unless it’s completely out of RAM. If it’s 100, the kernel will frequently swap out unused apps to make room for disk cache to speed up in-use apps.

    The default in Ubuntu is 60, so there you will sometimes see some swap use even with plenty of free memory.

    Also, once something is swapped, it will just sit there until the memory is modified, freed or something else needs the swap space. This means that trace swap usage can be caused by a short memory spike long ago and/or of short duration (maybe shorter than your logging tool).

    This is a sign of Linux’ effectiveness in not wasting work that has gone into writing pages to swap.

  10. January 30th, 2013 at 07:03 | #10

    Fantastic Vidar. Great explanation :-)

  11. Adam s.
    March 9th, 2013 at 00:35 | #11

    Hi Vidar,

    I really like your linux memory caching page and was wondering if I could upload it to and publish it to an internal network? I would of course credit your site.


  12. Vidar
    March 11th, 2013 at 01:33 | #12

    @Adam s.
    Sure, anything to spread the page cache love!

  13. Walter
    August 20th, 2013 at 17:02 | #13

    Hi Vidar,

    I want to ask you if I could translate your linuxatemyram.com site to spanish and post it on a public forum?.

    Regards and thank you for your nice explanation.

  14. Vidar
    August 20th, 2013 at 17:29 | #14

    Sure! Just make sure to link to the original.

  15. Thomas
    October 24th, 2013 at 18:22 | #15

    The bottom section of http://www.vidarholen.net/contents/junk/nicotine.html contains an error. A cigarette does not contain about 7mg of nicotine, but about 0.7mg; mine contains 0.6mg per cigarette. An aubergine has an average weight of 300g, so one aubergine contains about 30µg nicotine, which is 0.03mg nicotine; 0.6mg / 0.03mg is 20, so 20 aubergines holds the same amount of nicotine, as one of my light cigarettes does.

  16. Marcelo
    December 4th, 2013 at 11:58 | #16

    Hi Vidar,

    Congratulations for your https://github.com/koalaman/shellcheck! Is there any way to choose (enable/disable) the checks the shellcheck script will use? Is it possible (easily) to add additional checks if needed?

    Thanks in advance,

  17. Vidar
    December 4th, 2013 at 21:12 | #17


    For the latest, local git version, you can use shellcheck --exclude=SC1234,SC2345 file to exclude certain types of checks.

    Any new checks requires modifying the source code. It’s conceptually very simple, and most of the checks are under 15 lines of code, but it assumes familiarity with Haskell and I’m sure the a lot of the utility functions seem quirky and obscure. If you’d like to try, you can just browse the list of commits and see the diffs for adding new checks.

  18. Marcelo
    December 5th, 2013 at 11:21 | #18

    Thanks for your prompt response Vitar.

    I was able to clone, build and execute shellcheck using the exclude option.

    Have you already thought in create a SonarQube (http://docs.codehaus.org/display/SONAR/Plugin+Library) plugin for that?

    Best regards,

  19. Vidar
    December 14th, 2013 at 21:27 | #19

    I’m not familiar with SonarQube and I have no plans to integrate directly with it. Maybe you can use ShellCheck’s CheckStyle XML output and SonarQube’s CheckStyle plugin to bridge the gap?

  20. jwi
    August 1st, 2014 at 09:43 | #20

    Hi Vidar,

    I think you’re slightly wrong on linuxatemyram. There is an indirect claim on the main page, and a pretty direct claim on the play.html page that caches/buffers won’t ever cause an application to swap. This is incorrect though.

    Linux will swap out *unused* pages from applications to keep some disk caches alive, if that is possible. The threshold is controlled by the sysctl vm.swappiness. I assume that you cannot see this effect with munch.c, because it is actually active on most of its pages, thus it won’t get swapped.

    This gets pretty important on desktop systems. The default of vm.swappiness=60 makes linux to start swapping application data at 40% RAM usage, if it sees it fitting. On desktops, this often means to swap out the file manager or any other currently unused application (web browser, email client…) which has to be swapped in first.


  21. CJ
    November 6th, 2014 at 16:30 | #21

    Vidar – Thanks for the linuxatemyram site….I work with many people new to linux and its very effective in giving them a basic understanding of how memory looks in linux.


  1. No trackbacks yet.