- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: malloc/free debugging in a C code!
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
Forums
Discussions
Discussions
Discussions
Forums
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
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
тАО04-10-2002 02:17 AM
тАО04-10-2002 02:17 AM
I have a multi-code C project running on HP V-Class machines using MPI. The code crashes for at some free() statements, althought the things i am trying to free() look fine under the totalview debugger i am using. For different problem sizes, it crashes at different free() locations. Can someone help me with this? Is there any tool available on HPUX to help me diagnose this problem?
I badly need this information as I have a few deadlines to meet. Thanks in advance!
Ravi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2002 02:25 AM
тАО04-10-2002 02:25 AM
Re: malloc/free debugging in a C code!
It's pretty good at detecting MLK (memory leaks) and FUM (Freeing unallocated memory)
http://www.rational.com/products/purify_unix/index.jsp

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2002 02:32 AM
тАО04-10-2002 02:32 AM
Re: malloc/free debugging in a C code!
http://www.hpl.hp.com/personal/Hans_Boehm/gc/
It contains replacements for the malloc and free routines and can also be used as a leak detector.
Regards,
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2002 02:35 AM
тАО04-10-2002 02:35 AM
Re: malloc/free debugging in a C code!
http://www.rational.com/tryit/evals/purifyunix_eval.jsp

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2002 01:08 PM
тАО04-10-2002 01:08 PM
Re: malloc/free debugging in a C code!
i tried using purify, but it doesn't work with mpicc (multi-processor cc). the garbage collector is working with my code but it crashes my code at strange places. i will be trying it for the next few days to see how it goes. do you know of any other tools?
thanks,
ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2002 03:16 PM
тАО04-10-2002 03:16 PM
Re: malloc/free debugging in a C code!
Here's the skinny on it:
ElectricFence is a utility for C programming and
debugging. ElectricFence uses the virtual memory hardware of your
system to detect when software overruns malloc() buffer boundaries,
and/or to detect any accesses of memory released by
free(). ElectricFence will then stop the program on the first
instruction that caused a bounds violation and you can use your
favorite debugger to display the offending statement.
Install ElectricFence if you need a debugger to find malloc()
violations.
I'm not sure if it would work in a MPI environment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2002 03:18 PM
тАО04-10-2002 03:18 PM
Re: malloc/free debugging in a C code!
http://www.cs.colorado.edu/homes/zorn/public_html/MallocDebug.html
it's a neat overview of some tools.
Hope this helps
Scott.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2002 11:13 PM
тАО04-10-2002 11:13 PM
Re: malloc/free debugging in a C code!
thanks for the list and the intro on electric fence. i will certainly try to use some of them to see if they can work with my C code in MPI environment on HPUX. i tried running my code in the AIX environment on an IBM SP machine (to which i have only limited access) and these memory problems didn't occur there.
thanks again!
ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2002 11:18 PM
тАО04-10-2002 11:18 PM
Re: malloc/free debugging in a C code!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-11-2002 12:03 PM
тАО04-11-2002 12:03 PM
Re: malloc/free debugging in a C code!
will be of some use.
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-11-2002 10:30 PM
тАО04-11-2002 10:30 PM
Re: malloc/free debugging in a C code!
thanks! do you know how to use them or where i can find more information on how to use them!
ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-11-2002 11:01 PM
тАО04-11-2002 11:01 PM
Re: malloc/free debugging in a C code!
The man page for malloc itself has details on mallinfo() and memorymap().

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2002 02:00 PM
тАО04-14-2002 02:00 PM
SolutionYou wont see the same problems in AIX because AIX tends to clean up memory is deallocated but not freed.
We had a problem with an app ported from AIX to HPUX that had this problem.
We solved 90% of our memory problems by working on the theory that everywhere there was a memory allocation there should be a corresponding free.
Scott.