- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- C question
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
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
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
12-21-2004 09:56 AM
12-21-2004 09:56 AM
I have moved my C program from HP-UX 11.11 to Linux AS release 3 environment. I can recompiled the code on Linux successfully but I got memory dump error when try to run the executable. The problem is caused by free() function I used deallocate memory in the code. This is my gcc compiler version.
"Reading specs from /usr/lib/gcc-lib/i386-redhat-linux7/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-123)"
When I check the manpage for "free" on Linux return a different function (free - display information about free and used memory on the system).
How do I deallocate memory on Linux platfrom?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 10:18 AM
12-21-2004 10:18 AM
Re: C question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 10:22 AM
12-21-2004 10:22 AM
Re: C question
I am using getpwuid function and assuming it uses malloc(). Maybe I am wrong. The code with free() work just fine on HP-UX.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 10:25 AM
12-21-2004 10:25 AM
Re: C question
This is my code.
sessionid = (struct passwd*)getpwuid(getuid());
if (sessionid != NULL)
{
strcpy(user,sessionid->pw_name);
free(sessionid);
}
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 10:28 AM
12-21-2004 10:28 AM
Solution- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 10:33 AM
12-21-2004 10:33 AM
Re: C question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 06:29 PM
12-21-2004 06:29 PM
Re: C question
--8<---
The getpwnam_r () and getpwuid_r () functions find the same
information, but store the retrieved passwd structure in
the space pointed to by pwbuf. This passwd structure con-
tains pointers to strings, and these strings are stored in
the buffer buf of size buflen. A pointer to the result
(in case of success) or NULL (in case no entry was found
or an error occurred) is stored in *pwbufp.
-->8---
Enjoy, Have FUN! H.Merijn