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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:22:48+00:00 2026-06-18T00:22:48+00:00

I write app on AIX 5.3 using C++. I want to get current size

  • 0

I write app on AIX 5.3 using C++. I want to get current size of process virtual memory. I use getprocs64 function, but with this data I can’t get result as svmon shows.
Please help me.

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-18T00:22:49+00:00Added an answer on June 18, 2026 at 12:22 am

    I have found partially solution that is suitable for me.

    I ran small test app and see that pi_dvm, the member of procentry64 structure, will increase if we allocate memory on stack (for example: char arr[1024];) for size of allocated object and some overhead. Noiw, we want to calculate used heap size. We should use mallinfo() function from malloc.h that returns mallinfo struct. We are interested in two fields of mallinfo structure: usmblks and uordblks (about this fields you could read here). Some example code:

    pid_t pid = getpid();
    struct procentry64 p_info;
    if (getprocs64(&p_info, sizeof(p_info), NULL, 0, &pid, 1) < 0) {
      printf("Error!");
    }
    proc_size = p_info.pi_dvm*getpagesize() + p_info.pi_tsize;
    struct mallinfo m = mallinfo();
    proc_size += m.usmblks + m.uordblks;
    return proc_size; // proc_size in bytes
    

    P.S. I don’t know Why we sum pi_tsize (if anybody knows, please tell us). I get this idea from pg_top sources, but there is a bug, they multiply pi_tsize by 4, but it’s incorrect, because pi_tsize is in bytes.
    I hope this solution may help someone 🙂

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

Sidebar

Related Questions

I want to write a app that can be extended via plugins, using Perl
I want to write app in java which will get info about processes and
I want to write an app using Android SDK and Eclipse. I installed Android
I could write the app in HTML/CSS/JavaScript and use something like phoneGap but is
I want to write an app to transpose the key a wav file plays
I am going to write an app for google services, but I stuck at
I want to write app for company where i'm working. It will work only
I have write 2 app, A_app and B_app. In A_app, I want to call
I want to write an app that will allow a program like iTunes which
I decided to write an app like: http://michaelgrinich.com/hackernews/ but for Android devices, my idea

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.