Sponsored Content
Top Forums Programming Why memory allocated through malloc should be freed ? Post 302349162 by jlliagre on Monday 31st of August 2009 08:37:01 AM
Old 08-31-2009
All of a process allocated memory should be made available after it dies otherwise the OS will refuse to launch after some period of time.
What OS are you using ?
How are you measuring the memory usage ?
 

10 More Discussions You Might Find Interesting

1. Solaris

Memory allocated

Hi, How to find out what is the maximum memory allocated to TOMCAT server in SunOS 5.8? The Tomcat server crashes down during peak times.... Regards (1 Reply)
Discussion started by: baanprog
1 Replies

2. Programming

malloc gives the same memory to two different nodes. How to deal with it?

When allocating memory for two different nodes, the resulting memory are the same. Clearly, this will lead to a mistake. This happened in a function. And the process must be in a function. (gdb) p tree->list $43 = (node *) 0x8be4180 (gdb) p tree->list $44 = (node *) 0x8be4180 At the... (2 Replies)
Discussion started by: cdbug
2 Replies

3. Solaris

Memory usage in Solaris - memory not freed?

Hi, I'm running a multi-process software system on a Solaris 8 machine. When I monitor the memory usage, I see that the free memory is dropping rapidly, but I can't detect a process that uses this memory. I'm using "top" to get the free memory and the memory usage of processes. Thanks. (3 Replies)
Discussion started by: gewurtz
3 Replies

4. AIX

amount of memory allocated to large page

We just set up a system to use large pages. I want to know if there is a command to see how much of the memory is being used for large pages. For example if we have a system with 8GB of RAm assigned and it has been set to use 4GB for large pages is there a command to show that 4GB of the *GB is... (1 Reply)
Discussion started by: daveisme
1 Replies

5. HP-UX

how to find size of memory allocated to a pointer?

Hi, Am new to HP UX , is there a way to find out the size of memory allocated to a pointer on hp ux? For example we can use the _msize() on windows to find the size of memory allocated to a pointer . #include <stdio.h> #include <malloc.h> void main() { void *buffer; ... (0 Replies)
Discussion started by: Wkdunreal
0 Replies

6. Programming

Regarding the maximum memory allocated by malloc() function on HP-UX B11.11

In a 'C' program,when I am trying to allocate memory with the help of malloc () function, it is allocating the memory up to a certain limit for e.g. in my case, it is 670 MB (approx). malloc() returns NULL if I allocate more than this amount of memory.When I tried to allocate memory in chunks of... (1 Reply)
Discussion started by: vipinsachan
1 Replies

7. Programming

./match_pattern.out: malloc(): memory corruption: 0x0000000013a11600 ***

Hi All, I have a simple code which does some computation by matching string patterns. In brief: 1. The code reads .dat and .txt files. 2. .dat files are huge text files and .txt files contain some important words. 3. I am just doing strstr to find the patterns. 4. The function returns the... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

8. Programming

glib detected: malloc() memory curruption

I am using libxml2 library for XMl parsing and libxml++ is C++ wrapper over that. So I am using API of libxml++. I am creating my class and composing instance xmlpp::Node *pNode in that. my class also have funciton prepareXPathQuery() which creates query string and have other fucntion... (2 Replies)
Discussion started by: sharadwagh
2 Replies

9. Red Hat

KVM/Qemu allocated memory not showing in guest

So we have a RHEL 7.6 workstation with 128 gigs of ram. The OS sees all the ram and 80 cors (40 HT) We have 1 guest with 8 CPUs and 32gigs of ram running RHEL 7.6 workstation as well. We are trying to create another guest with 64 CPUs and 80 gigs of ram. We setup the system using... (0 Replies)
Discussion started by: joeg1484
0 Replies

10. UNIX for Beginners Questions & Answers

How to change allocated memory for a process?

Hello, I am running ubuntu 14.04 in a server with 32GB ram. Due to receiving "high load" errors during ssh connection, I took a look at what's happening from command line. I detected that 20GB of total memory was allocated to a program. Below you can see some initial part of installation... (4 Replies)
Discussion started by: baris35
4 Replies
pthread_mutexattr_getrobust_np(3C)										pthread_mutexattr_getrobust_np(3C)

NAME
pthread_mutexattr_getrobust_np, pthread_mutexattr_setrobust_np - get or set robustness attribute of mutex attribute object SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ] #include <pthread.h> int pthread_mutexattr_getrobust_np(const pthread_mutexattr_t *attr, int *robustness); int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *attr, int robustness); The following applies only if the symbol _POSIX_THREAD_PRIO_INHERIT is defined, and the mutex attributes object attr should be used only to initialize mutexes that will also be initialized with the protocol attribute having the value PTHREAD_PRIO_INHERIT. See pthread_mutex- attr_getprotocol(3C). The pthread_mutexattr_setrobust_np() and pthread_mutexattr_getrobust_np() functions set and get the robustness attribute of a mutex attribute object pointed to by attr that was previously created by the function pthread_mutexattr_init(3C). The robustness attribute defines the behavior when the owner of a mutex dies. The value of robustness may be ether PTHREAD_MUTEX_ROBUST_NP or PTHREAD_MUTEX_STALLED_NP, which are defined by the header <pthread.h>. The default value of the robustness attribute is PTHREAD_MUTEX_STALLED_NP. When the owner of a mutex with the PTHREAD_MUTEX_STALLED_NP robustness attribute dies, all future calls to pthread_mutex_lock(3C) for this mutex will be blocked from progress in an unspecified manner. When the owner of a mutex with the PTHREAD_MUTEX_ROBUST_NP robustness attribute dies, the mutex is unlocked. The next owner of this mutex acquires it with an error value of EOWNERDEAD. Note that the application must always check the return value from pthread_mutex_lock() for a mutex initialized with the PTHREAD_MUTEX_ROBUST_NP robustness attribute. The new owner of this mutex should then attempt to make the state protected by the mutex consistent, since this state could have been left inconsistent when the last owner died. If the new owner is able to make the state consistent, it should call pthread_mutex_consistent_np(3C) for the mutex and then unlock the mutex. If for any reason the new owner is not able to make the state consistent, it should not call pthread_mutex_consistent_np() for the mutex, but should simply unlock the mutex. In the latter scenario, all waiters will be awakened and all subsequent calls to pthread_mutex_lock() will fail in acquiring the mutex with an error value of ENOTRECOVERABLE. The mutex can then be made consistent by uninitializing the mutex with the pthread_mutex_destroy() function and reinitializing it with the pthread_mutex_init() function. If the thread that acquired the lock with EOWNERDEAD dies, the next owner will acquire the lock with an error value of EOWNERDEAD. Note that the mutex may be in memory shared between processes or in memory private to a process, i.e. the "owner" referenced above is a thread, either within or outside the requestor's process. The mutex memory must be zeroed before initialization. Upon successful completion, the pthread_mutexattr_getrobust_np() and pthread_mutexattr_setrobust_np() functions return 0. Otherwise, an error number is returned to indicate the error. The pthread_mutexattr_getrobust_np() and pthread_mutexattr_setrobust_np() functions will fail if: EINVAL The value specified by attr or robustness is invalid. ENOSYS The option _POSIX_THREAD_PRIO_INHERIT is not defined and the implementation does not support the function. ENOTSUP The value specified by robustness is an unsupported value. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level | MT-Safe | +-----------------------------+-----------------------------+ pthread_mutex_lock(3C), pthread_mutex_consistent_np(3C), pthread_mutexattr_getprotocol(3C), attributes(5), mutex(5), standards(5) 23 Mar 2005 pthread_mutexattr_getrobust_np(3C)
All times are GMT -4. The time now is 08:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy