- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: RSS/VSS value increases after excution of "new...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2014 01:49 AM - last edited on 11-05-2014 06:24 PM by Lisa198503
11-05-2014 01:49 AM - last edited on 11-05-2014 06:24 PM by Lisa198503
RSS/VSS in"glance"(HP_UX):value increases after excution of"new" but never comes down after"delete"
Hi All,
We are having concern in the glance report being rendered in HU_UX which depicts the value of RSS/VSS . Basically we are doing dynamic memory allocation in our application. Or in other words using "new" and "delete" of c++ . Whenever we are allocating memory using "new" , we could see increased value reflecting right away in that RSS/VSS. However the shown value is not coming down after the executing of "delete" even after waiting for several minutes ( i.e. doing other works in that programme without exiting after executing of the “delete” ) . This is actually confusing because, we expect if RSS/VSS value is increasing upon execution of "new", the same value should be seen going down upon execution of "delete" .
code is pretty straightforward and shown below:
=============================
#include<iostream.h>
#include<stream.h>
int main()
{
int *temp;
cout<<"Before the action"<<endl;
sleep(120);
int n;
for(int i=1;i<5;i++)
{
cout<<"\n Iteration :\t "<<i<<endl;
n= 10737411;
temp = new int[10737411+n*i];
cout<<"memory acquired"<<endl;
sleep(30);
delete[] temp;
cout<<"de-allocation done"<<endl;
sleep(30);
}
sleep(10);
return 0;
}
=============================
Corresponding observation through glance:
Type RefCt RSS VSS Locked File Name
DATA /Priv 1 92kb 96kb 0kb /u02/.../test_cc.exe ( start of test programme)
DATA /Priv 1 140kb 163.9mb 0kb /u02/.../test_cc.exe ( after allocation )
DATA /Priv 1 140kb 163.9mb 0kb /u02/.../test_cc.exe ( after de-allocation of memory acquired)
DATA /Priv 1 156kb 204.9mb 0kb /u02/.../test_cc.exe ( allocation of bigger chunk )
DATA /Priv 1 156kb 204.9mb 0kb /u02/.../test_cc.exe (de-allocation of bigger chunk)
DATA /Priv 1 156kb 204.9mb 0kb /u02/.../test_cc.exe (Process stopped)
What is the meaning of this behavior ? Whether "system memory allocation" algorithm implemented by HP_UX works little differently than we are expecting ? Whether memory acquired will not be released back to OS ? if yes then when and how we will be able to see it. We are seeing it never coming down ( RSS/VSS value ). How to determine , at any given point in time , the actual memory (resident memory) acquired by any process in HP_UX. Since the value appearing in RSS never comes down, does that mean: the acquired memory is not available to other process as long as the first process is running ? Or it will be available to others ( if so how to identify that ). We are using HP_UX Itanium version 11.31
Please clarify . Appreciate your time and valuable inputs.
Thanks in advance.
Thanks & Regards
Dibendu
P.S. This thread has been moved from HP-UX>General to HP-UX > languages. -HP Forum Moderator
- Tags:
- heap usage
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2014 07:11 AM - edited 11-05-2014 09:59 AM
11-05-2014 07:11 AM - edited 11-05-2014 09:59 AM
Re: RSS/VSS value increases after excution of "new" but never comes down
>Whether memory acquired will not be released back to OS?
This is how the heap works on many OSes. Once acquired it is kept around, assuming it eventually be reused.
>Since the value appearing in RSS never comes down
Your RSS doesn't come down since it only increased by a trivial amount since you didn't touch all those pages.
The RSS should come down if you are allocating multi-page blocks, when there is memory pressure.
>does that mean: the acquired memory is not available to other process as long as the first process is running?
It depends, the pages could be swapped out and then reused by other processes.
If you are allocating huge blocks for a short period of time that you want to go away, you could look at mmap(2) and munmap(2). For C++, you can write your own allocators.
These previous topics may help:
http://h30499.www3.hp.com/t5/Languages-and-Scripting/Vector-doesn-t-release-memory/m-p/4095208
http://h30499.www3.hp.com/t5/Languages-and-Scripting/vector-STL-doesn-t-release-memory/m-p/4095214
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 02:21 AM
11-06-2014 02:21 AM
Re: RSS/VSS value increases after excution of "new" but never comes down
Hi Denis and All,
Thanks a million for your quick and valuable inputs. It really helps.
In order to get the exact instantaneous free and used block , we used GDB provided "info heap processes" command. The total memory allocated for ARENA is divided as below
Total space in arenas
Number of bytes in free small blocks
Number of bytes in used small blocks
Number of bytes in free ordinary blocks
Number of bytes in used ordinary blocks
Number of bytes in holding block header
We are considering free blocks as : Number of bytes in free small blocks + Number of bytes in free ordinary blocks +
Used blocks as : Number of bytes in used small blocks + Number of bytes in used ordinary blocks + Number of bytes in holding block header
Following is a small extract of the data gathered out of it.
When process just started , before memory allocation :
Glance:
RSS/VSS 92 kb/96 kb
GDB Info heap process data :
Total Free in blocks 0.04776001 mb
Total Used in blocks 0.02976989 mb
After Memory allocation :
Glance:
RSS/VSS 108kb/82.0mb
GDB Info heap process data :
Total Free in blocks 0.045379639 mb
Total Used in blocks 81.95011902 mb
After memory de-allocation :
Glance:
RSS/VSS 108kb/82.0mb
GDB Info heap process data :
Total Free in blocks 81.96533203 mb
Total Used in blocks 0.030166626 mb
So We are seeing that even though RSS/VSS value does not come down but :
The value of VSS = Free blocks + Used blocks.
1> When memory allocated : free was 0.04mb and Used was 81.9mb
2> When memory de-allocated : free was 81.9mb and Used was 0.03mb
Is our above understanding is correct ?
Can we conclude that after de-allocation the "free blocks" are available for further use(same process/other process) ?
is there way we can find out something like (Free + used) of RSS ? We are not sure how to calculate RSS from GDB provided statistics
I am attaching one excel with more clean and detailed statistics collected from both glance and GDB for each allocation and de-allocation iteration. Please refer it for more elaborate data.
Thanking again for having a look and sharing your thoughts and experience.
Thanks & Regards
Dibendu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 10:35 AM
11-06-2014 10:35 AM
Re: RSS/VSS value increases after excution of "new" but never comes down
>we used GDB provided "info heap processes" command.
You can look at mallinfo(3). But it doesn't work too well for a 64 bit process.
>Is our above understanding is correct?
Yes.
>Can we conclude that after de-allocation the "free blocks" are available for further use (same process/other process)?
Only by same process.
>is there way we can find out something like (Free + used) of RSS?
No. RSS is related to when the page was touched last, not if it is free. In your test case RSS is approximately 0.
>We are not sure how to calculate RSS from GDB provided statistics
Only the kernel knows how to compute RSS. But you might be able to use pstat_getprocvm(2).
>I am attaching one excel with more clean and detailed statistics collected from both glance and GDB
Is this for your real application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2014 02:54 AM
11-07-2014 02:54 AM
Re: RSS/VSS value increases after excution of "new" but never comes down
Hi Dennis,
Thanks again for clarifying our doubts.
The data I attached is from teh sameple program whcih I have pasted in this thread . Basically our real application behaviour is inline with this.
You mentioned that :
after de-allocation the "free blocks" are available for further use by the same process only. This is little confusing. Because in your first response, you mentioned that under pressure situation the free mememory can be used by other processes. OS should be taking care of required action for this purpose.
Appreciate your inputs this direction.
Thanks & Regards
Dibendu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2014 10:35 AM
11-07-2014 10:35 AM
Re: RSS/VSS value increases after excution of "new" but never comes down
>you mentioned that under pressure situation the free memory can be used by other processes.
Sorry for the confusion. Pages on the free list are still part of the VSS and can be swapped out of memory and the RSS reduced. Then the physical pages can be reused by another process.
So there are virtual pages that can't be reused and physical pages that can. But you must have enough swap to hold that VSS.
(Virtual pages can also be shared with mmap(2) and shared memory.)