HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Memory allocations not being freed back to OS
Operating System - HP-UX
1829888
Members
2453
Online
109993
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
03-13-2002 07:25 AM
03-13-2002 07:25 AM
Hello,
I am working on a C++ application that is called from JAVA via JNI calls. My application makes very large allocations via operator new. (I am also using the SmartHeap memory manager tool). I then delete these large allocations. However, when looking at the process through the top utility, I don't see the memory size of the process go down. I have already gone through the code removing memory leaks, so that is not the problem. Why does memory (either the SIZE or RES) not decrease? Should I be using another tool other than top to measure memory usage? Am I missing something here?
Any ideas from anyone out there?
Thanks in advance for your help...
Steve Colbert
I am working on a C++ application that is called from JAVA via JNI calls. My application makes very large allocations via operator new. (I am also using the SmartHeap memory manager tool). I then delete these large allocations. However, when looking at the process through the top utility, I don't see the memory size of the process go down. I have already gone through the code removing memory leaks, so that is not the problem. Why does memory (either the SIZE or RES) not decrease? Should I be using another tool other than top to measure memory usage? Am I missing something here?
Any ideas from anyone out there?
Thanks in advance for your help...
Steve Colbert
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2002 07:42 AM
03-13-2002 07:42 AM
Solution
have a look at this link:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xd4be0bce6f33d6118fff0090279cd0f9,00.html
for procedure.
Later,
Bill
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xd4be0bce6f33d6118fff0090279cd0f9,00.html
for procedure.
Later,
Bill
It works for me (tm)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2002 07:55 AM
03-13-2002 07:55 AM
Re: Memory allocations not being freed back to OS
Hi Steve:
When you free process memory using free(), the memory is not returned to the OS but rather goes back on the process's heap fore reuse by the same process. You can use the sbrk() system call with a negative vaue to decrease allocated process space but this is not for the faint of heart. If you use sbrk(), you must not use any of the higher-level memory allocation/free functions or absolute chaos including crashes is almost guaranteed.
When you free process memory using free(), the memory is not returned to the OS but rather goes back on the process's heap fore reuse by the same process. You can use the sbrk() system call with a negative vaue to decrease allocated process space but this is not for the faint of heart. If you use sbrk(), you must not use any of the higher-level memory allocation/free functions or absolute chaos including crashes is almost guaranteed.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2002 09:23 AM
03-13-2002 09:23 AM
Re: Memory allocations not being freed back to OS
Hello,
What you see is normal.
For a program that frees allocated memory you
will not always see an imediate reduction in
size.
When the system becomes short of memory however this
memory will be returned to the system for re-use and the size of the process will decrease
as you would expect after a call to free.
So this decrease in size will not be observered
if the system is not starved of memory.
I did a test of this about one year ago and
verified this behaviour.
So in short, you should not worry.
Olav
What you see is normal.
For a program that frees allocated memory you
will not always see an imediate reduction in
size.
When the system becomes short of memory however this
memory will be returned to the system for re-use and the size of the process will decrease
as you would expect after a call to free.
So this decrease in size will not be observered
if the system is not starved of memory.
I did a test of this about one year ago and
verified this behaviour.
So in short, you should not worry.
Olav
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP