Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7715243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:20:11+00:00 2026-06-01T02:20:11+00:00

I was confused about the Pss column in /proc/pid/smaps , so I wrote a

  • 0

I was confused about the Pss column in /proc/pid/smaps, so I wrote a program to test it:

void sa();
int main(int argc,char *argv[])
{
    int fd;
    sa();
    sleep(1000);
}

void sa()
{
   char *pi=new char[1024*1024*10];
   for(int i=0;i<4;++i) {
        for(int j=0;j<1024*1024;++j){
                *pi='o';
                pi++;
        }
   }
   int cnt;
   for(int i=0;i<6;++i) {
        for(int j=0;j<1024*1024;++j){
                cnt+=*pi;
                pi++;
        }
   }
   printf("%d",cnt);
}
$cat /proc/`pidof testprogram`/smaps

08838000-0885b000 rw-p 00000000 00:00 0          [heap]
Size:                140 kB
Rss:                  12 kB
Pss:                  12 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:        12 kB
Referenced:           12 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
b6dcd000-b77d0000 rw-p 00000000 00:00 0 
Size:              10252 kB
Rss:               10252 kB
Pss:                4108 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:      4108 kB
Referenced:         4108 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB

Here I found Pss equal to Private_Dirty, but I wonder why.

BTW: Is there any detailed documentation for smaps?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:20:12+00:00Added an answer on June 1, 2026 at 2:20 am

    Quoting from lwn.net

    The “proportional set size” (PSS) of a process is the count of pages
    it has in memory, where each page is divided by the number of
    processes sharing it. So if a process has 1000 pages all to itself,
    and 1000 shared with one other process, its PSS will be 1500

    From Linux Kernel Documentation,

    The /proc/PID/smaps is an extension based on maps, showing the memory
    consumption for each of the process’s mappings. For each of mappings there
    is a series of lines such as the following:

    08048000-080bc000 r-xp 00000000 03:02 13130      /bin/bash
    Size:               1084 kB
    Rss:                 892 kB
    Pss:                 374 kB
    Shared_Clean:        892 kB
    Shared_Dirty:          0 kB
    Private_Clean:         0 kB
    Private_Dirty:         0 kB
    Referenced:          892 kB
    Anonymous:             0 kB
    Swap:                  0 kB
    KernelPageSize:        4 kB
    MMUPageSize:           4 kB
    Locked:              374 kB
    

    The first of these lines shows the same information as is displayed
    for the mapping in /proc/PID/maps. The remaining lines show the size
    of the mapping (size), the amount of the mapping that is currently
    resident in RAM (RSS), the process’ proportional share of this mapping
    (PSS), the number of clean and dirty private pages in the mapping.
    Note that even a page which is part of a MAP_SHARED mapping, but has
    only a single pte mapped, i.e. is currently used by only one process,
    is accounted as private and not as shared. “Referenced” indicates the
    amount of memory currently marked as referenced or accessed.
    “Anonymous” shows the amount of memory that does not belong to any
    file. Even a mapping associated with a file may contain anonymous
    pages: when MAP_PRIVATE and a page is modified, the file page is
    replaced by a private anonymous copy. “Swap” shows how much
    would-be-anonymous memory is also used, but out on swap.

    This Question on Unix and Linux Stackexchange covers almost the topic. See Mat’s excellent answer which will surely clear all your doubts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am confused about strings and int. and can't validate a name to be
I've always been confused about this one. Consider the following loops: int [] list
I am confused about how enums work with classes.. Here is my test code...
I'm a bit confused about how many controllers I need, and when I can
I am confused about the licensing model for Microsoft PerformancePoint Server. When I look
I am confused about the terms overestimation/underestimation. I perfectly get how A* algorithm works,
I'm confused about NSUserDefaults on the iPhone. I come from a C / asm
I'm always confused about thread concepts. I haven't a chance to use them in
I am confused about what means the update and delete rule in SQL Server
I am confused about how to make a Form visible. When we create a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.