    # File lib/phusion_passenger/admin_tools/memory_stats.rb, line 136
            def system_ram_usage
                    @total_system_ram ||= begin
                            case ruby_platform
                            when /linux/
                                    free_text = `free -k`

                                    free_text =~ %r{Mem:(.+)$}
                                    line = $1.strip
                                    total = line.split(/ +/).first.to_i

                                    free_text =~ %r{buffers/cache:(.+)$}
                                    line = $1.strip
                                    used = line.split(/ +/).first.to_i

                                    [total, used]
                            when /darwin/
                                    vm_stat = `vm_stat`
                                    vm_stat =~ /page size of (\d+) bytes/
                                    page_size = $1
                                    vm_stat =~ /Pages free: +(\d+)/
                                    free = $1
                                    vm_stat =~ /Pages active: +(\d+)/
                                    active = $1
                                    vm_stat =~ /Pages inactive: +(\d+)/
                                    inactive = $1
                                    vm_stat =~ /Pages wired down: +(\d+)/
                                    wired = $1

                                    if page_size && free && active && inactive && wired
                                            page_size = page_size.to_i
                                            free = free.to_i * page_size / 1024
                                            active = active.to_i * page_size / 1024
                                            inactive = inactive.to_i * page_size / 1024
                                            wired = wired.to_i * page_size / 1024

                                            used = active + wired
                                            [free + inactive + used, used]
                                    else
                                            nil
                                    end
                            else
                                    `top` =~ /(\d+)(K|M) Active, (\d+)(K|M) Inact, (\d+)(K|M) Wired,.*?(\d+)(K|M) Free/
                                    if $1 && $2 && $3 && $4 && $5 && $6 && $7 && $8
                                            to_kb = lambda do |number, unit|
                                                    if unit == 'K'
                                                            number.to_i
                                                    else
                                                            number.to_i * 1024
                                                    end
                                            end

                                            active = to_kb.call($1, $2)
                                            inactive = to_kb.call($3, $4)
                                            wired = to_kb.call($5, $6)
                                            free = to_kb.call($7, $8)

                                            used = active + wired
                                            [free + inactive + used, used]
                                    else
                                            nil
                                    end
                            end
                    end
            end