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 9020791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:06:24+00:00 2026-06-16T05:06:24+00:00

this, I hope, is a simple question. I am familiar with the idea that

  • 0

this, I hope, is a simple question. I am familiar with the idea that fork in unix/linux/etc does not actually copy an entire image, but maps shared memory as private with a copy-on-write flag. To illustrate this, I tried the following example below which I expected would show the large malloc’d region as private (copy on write). However, I get the output below. Can anyone help shed light on why this is? My assumption is that my OS works as expected (uname -a: Linux xxxxxx 2.6.32-279.19.1.el6.x86_64 #1 SMP Tue Dec 18 17:22:54 CST 2012 x86_64 x86_64 x86_64 GNU/Linux) but pmap is not working as I expect..

int main(int argc, char *argv[]) {

    pid_t pid;
    char syscmd[80];
    char *somebuffer=(char*)malloc(999999999l);
    pid = fork();
    if (0 == pid) { /* Child */
            sprintf(syscmd, "pmap -x %d", getpid());
            system(syscmd);

    } else { /* parent */
            wait(NULL);
    }

    return 0;
}

output:

9822:   ./a.out
Address           Kbytes     RSS   Dirty Mode   Mapping
0000000000400000       4       4       0 r-x--  a.out
0000000000600000       4       4       4 rw---  a.out
000000357e000000     128      24       0 r-x--  ld-2.12.so
000000357e21f000       4       4       4 r----  ld-2.12.so
000000357e220000       4       4       4 rw---  ld-2.12.so
000000357e221000       4       4       4 rw---    [ anon ]
000000357e400000    1572     120       0 r-x--  libc-2.12.so
000000357e589000    2048       0       0 -----  libc-2.12.so
000000357e789000      16      12       8 r----  libc-2.12.so
000000357e78d000       4       4       4 rw---  libc-2.12.so
000000357e78e000      20      16      16 rw---    [ anon ]
00007f64228ad000  976576      16      16 rw---    [ anon ]
00007f645e27b000       4       4       4 rw---    [ anon ]
00007f645e27c000       4       0       0 r-x--    [ anon ]
00007fff2a1eb000      84      12      12 rw---    [ stack ]
ffffffffff600000       4       0       0 r-x--    [ anon ]
----------------  ------  ------  ------
total kB          980480     228      76

:: why isn’t that large region (and probably others) marked as private?

Thanks!

  • 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-16T05:06:25+00:00Added an answer on June 16, 2026 at 5:06 am

    I think the pmap program just fails to print this information. Why are you using an odd utility like that instead of just cat /proc/%d/maps?

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

Sidebar

Related Questions

This is kind of a simple question that I hope can be answered easily,
Hope this question is not stupid since I am an amateur web designer. I
I hope this question isn't too general. Well, the situation is that I am
I hope this question isn't too dumb. We have many websites internally that need
I hope this question takes a simple fix, and I am just missing something
I hope this question isn't too simple, I tried to go through the postgresql
I hope this is quite a simple question.. I've got a compiled .exe program
The question is ,I hope,simple for someone who knows about character encoding. This is
Very simple question I hope. I have the usual <select> box like this <select
I hope this is a very simple question, what is the Android equivalent to

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.