Tagged: ,

  • What does Virtual memory size in top mean?

     Joseph updated 10 months, 3 weeks ago 2 Members · 2 Posts
  • james

    August 21, 2020 at 12:43 pm

    I am running top to monitor my server performance and 2 of my java processes show virtual memory of up to 800MB-1GB. Is that a bad thing?

    What does virtual memory mean?

    And oh btw, I have swap of 1GB and it shows 0% used. So I am confused.

    Java process = 1 Tomcat server + my own java daemon Server = Ubuntu 9.10 (karmic)

  • Joseph

    August 21, 2020 at 1:08 pm

    Virtual memory isn’t even necessarily memory. For example, if a process memory-maps a large file, the file is actually stored on disk, but it still takes up “address space” in the process.

    Address space (ie. virtual memory in the process list) doesn’t cost anything; it’s not real. What’s real is the RSS (RES) column, which is resident memory. That’s how much of your actual memory a process is occupying.

    But even that isn’t the whole answer. If a process calls fork(), it splits into two parts, and both of them initially share all their RSS. So even if RSS was initially 1 GB, the result after forking would be two processes, each with an RSS of 1 GB, but you’d still only be using 1 GB of memory.

    Confused yet? Here’s what you really need to know: use the free command and check the results before and after starting your program (on the +/- buffers/cache line). That difference is how much new memory your newly-started program used.

Viewing 1 - 2 of 2 replies

Log in to reply.

Original Post
0 of 0 posts June 2018