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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
I have found partially solution that is suitable for me.
I ran small test app and see that
pi_dvm, the member ofprocentry64structure, 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 usemallinfo()function frommalloc.hthat returnsmallinfostruct. We are interested in two fields ofmallinfostructure:usmblksanduordblks(about this fields you could read here). Some example code: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 multiplypi_tsizeby 4, but it’s incorrect, becausepi_tsizeis in bytes.I hope this solution may help someone 🙂