Sponsored Content
Full Discussion: Memory Leaks
Top Forums Programming Memory Leaks Post 302721443 by Don Cragun on Thursday 25th of October 2012 11:56:17 AM
Old 10-25-2012
All memory allocated by a process is returned to the system when the process terminates.

A very small amount of memory will remain after the process terminates that indicates the status of the terminated process. That memory will be released when the process that started the terminated process either gathers the exit status of its dead child (by calling something like wait()) or terminates.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

memory leaks

Hi!! Experts, Any ideas how to check for the memory leaks in a process during performance testing?? I dont use purify.. Any way of finding it out using default S/W in HP UX-11 Can U gimme pointers to site having good scripts/tutorials on performance testing?? Thanx in Advance.. :) (3 Replies)
Discussion started by: jyotipg
3 Replies

2. HP-UX

Memory leaks on HP-UX 11i

Hi folks, We are using following listed configurations for a particular application. HP-UX 11i Sun Java 2 SDK Standard Edition 1.4.1 (version shipped with WebLogic 8) Oracle 9i Release 2 (Oracle 9.2.0) BEA WebLogic Server 8.1 SP3 It seems a memory leak when we use above configurations.... (1 Reply)
Discussion started by: gimhan90
1 Replies

3. Programming

Tool for finding memory leaks

hi, i am a c++ programmer working on linux(redhat linux8.0) environment, i need to find out the memory leaks, so far i didn't used any tools, so what are the tools are available, and whic one is good to use. plz provide with a small example. (1 Reply)
Discussion started by: sarwan
1 Replies

4. UNIX for Advanced & Expert Users

strange problem with memory leaks

Hi Unix lovers, I am facing a strange problem about memory leak. One component of our product show memory leak at customer's end but not in development environment. The memory used by the exe goes on increasing at customer end but not in dev. customer has same m/c(HP unix 11i) , the same... (1 Reply)
Discussion started by: shriashishpatil
1 Replies

5. Shell Programming and Scripting

Find memory leaks shell script ???

Hi all, Has anyone out there a shell script to detect memory leaks on unix machines? And if so what way did they go about it .? (5 Replies)
Discussion started by: nano2
5 Replies

6. UNIX and Linux Applications

Looking for memory leaks freeware tools

Hello all Is there good free ware tools to check software memory leaks ? Some thing like purify on unix platforms sun/hp/linux Thanks (3 Replies)
Discussion started by: umen
3 Replies

7. Solaris

How to find Total and Free Physical Memory and Logical Memory in SOLARIS 9

Hi, Im working on Solaris 9 on SPARC-32 bit running on an Ultra-80, and I have to find out the following:- 1. Total Physical Memory in the system(total RAM). 2. Available Physical Memory(i.e. RAM Usage) 3. Total (Logical) Memory in the system 4. Available (Logical) Memory. I know... (4 Replies)
Discussion started by: 0ktalmagik
4 Replies

8. AIX

valgrind - pthread memory leaks on AIX

Hi all, I have written a small code just to invoke main and return immediately. When built with libpthread on AIX box, valgrind throws lots of memory leak errors. But when built without libpthread, no issues at all. Here is the sample run for your look. Any idea where I might be going wrong?... (3 Replies)
Discussion started by: visionofarun
3 Replies

9. Emergency UNIX and Linux Support

Memory leaks on compilations

Hello! I've been struggling for not few hours with memory leaks on this machine. I'm running linux 2.6.32-5-686, and the problem is as follows: Some months ago, I have compiled kernel 2.6.33-2-686 without any issues in this same machine. This week I have tried compiling GNUzilla Icecat and... (23 Replies)
Discussion started by: teresaejunior
23 Replies

10. Solaris

[DOUBT] Memory high in idle process on Solaris 10 (Memory Utilization > 90%)

Hi Experts, Our servers running Solaris 10 with SAP Application. The memory utilization always >90%, but the process on SAP is too less even nothing. Why memory utilization on solaris always looks high? I have statement about memory on solaris, is this true: Memory in solaris is used for... (4 Replies)
Discussion started by: edydsuranta
4 Replies
wait(2) 							System Calls Manual							   wait(2)

Name
       wait, wait3, waitpid - wait for process to terminate

Syntax
       #include <sys/types.h>
       #include <sys/wait.h>

       pid = wait(status)
       pid_t pid;
       union wait *status;

       pid = wait((union wait*)0)
       pid_t pid;

       #include <sys/time.h>
       #include <sys/resource.h>

       pid = wait3(status, options, rusage)
       pid_t pid;
       union wait *status;
       int options;
       struct rusage *rusage;

       pid = waitpid(pid, status, options)
       pid_t pid;
       union wait *status;
       int options;

Description
       The  system call causes its caller to delay either until a signal is received or one of its child processes terminates.	If a child process
       has died since the last return is immediate, returning the process id and exit status of one of the terminated child processes.	If a child
       process does not exist, return is immediate, with the value -1 returned.

       On  return  from a successful call, if status is nonzero, the high byte of status contains the low byte of the argument to exit supplied by
       the child process; the low byte of status contains the termination status of the process.  A more precise definition of the status word	is
       given in

       The system call provides an alternate interface for programs that must not block when collecting the status of child processes.	The status
       parameter is defined as above.  The options parameter is used to indicate that the call should not block if there  are  no  processes  that
       wish  to  report  status  (WNOHANG), or that only children of the current process, which are stopped due to a SIGTTIN, SIGTTOU, SIGTSTP, or
       SIGSTOP signal, should have their status reported (WUNTRACED).  If rusage is nonzero, a summary of the resources  used  by  the	terminated
       process and all its children is returned (this information is not available for stopped processes).

       When  the WNOHANG option is specified and no processes wish to report status, returns a pid of zero (0).  The WNOHANG and WUNTRACED options
       can be combined by ORing the two values.

       See for a list of termination statuses (signals).  A 0 status indicates normal termination.  A special status  (0177)  is  returned  for  a
       process	stopped  by  the process tracing mechanism, If the 0200 bit of the termination status is set, a core image of the process was pro-
       duced by the system.

       If the parent process terminates without waiting on its children, the initialization process (process ID = 1) inherits the children.

       The system call provides an interface for programs that want to wait for a specific child process or child processes from specific  process
       groups. The system call behaves as follows:

       o    If pid is equal to -1, status is requested for any child process.

       o    If pid is greater than zero, it specifies the process ID of a single child process for which status is requested.

       o    If pid is equal to zero, status is requested for any child process whose process group ID is equal to that of the calling process.

       o    If pid is less than -1, status is requested for any child process whose process group ID is equal to the absolute value of pid.

       The  status  and options arguments are defined as above.  The system call behaves identically to the system call, if the pid argument has a
       value of -1 and the options argument has a value of zero (0).

       The and system calls are automatically restarted when a process receives a signal while awaiting termination of a child process, unless the
       SV_INTERRUPT bit has been set for that signal. See

       The following macros, defined in can be used to interpret the information contained in the status parameter returned by the wait functions;
       the stat_val argument is the value pointed to by the status argument.

       WIFEXITED(stat_val)
	      Evaluates to a nonzero value, if status was returned for a child process that terminated normally.

       WEXITSTATUS(stat_val)
	      If the value of WIFEXITED(stat_val) is nonzero, this macro evaluates to the low-order eight bits of the  status  argument  that  the
	      child process passes to or or the value the child process returned from

       WIFSIGNALED(stat_val)
	      Evaluates to a nonzero value, if status was returned for a child process that terminated due to the receipt of a signal that was not
	      caught.

       WTERMSIG(stat_val)
	      If the value of WIFSIGNALED(stat_val) is nonzero, this macro evaluates to the number of the signal that caused  the  termination	of
	      the child process.

       WIFSTOPPED(stat_val)
	      Evaluates to a nonzero value, if status was returned for a child process that is currently stopped.

       WSTOPSIG(stat_val)
	      If  the  value of WIFSTOPPED(stat_val) is nonzero, this macro evaluates to the number of the signal that caused the child process to
	      stop.

Return Values
       If or returns due to a stopped or terminated child process, the process ID of the child is returned to the calling process.   Otherwise,  a
       value of -1 is returned, and errno is set to indicate the error.

       The  and system calls return -1, if there are no children not previously waited for.  A value of zero (0) is returned, if WNOHANG is speci-
       fied and there are no stopped or exited children.

Environment
       SYSTEM_FIVE

       When your program is compiled using the System V environment, when the SIGCLD signal is being ignored, continues until all children  termi-
       nate.  SIGCLD is the same as SIGCHLD.

       In addition, when using the System V environment, status is of type int *.

       POSIX

       When using the POSIX environment, status is of type int *.

       In addition, the SV_INTERRUPT flag is always set in POSIX mode, causing the above system calls to always fail, if interrupted by a signal.

Diagnostics
       The or system calls fail and return is immediate, if any of the following is true:

       [ECHILD]       The calling process has no existing unwaited-for child processes.

       [ECHILD]       The process or process group specified by pid does not exist or is not a child of the calling process.

       [EINTR]	      The function was interrupted by a signal. The value of the location pointed to by status is undefined.

       [EINVAL]       The value of the options argument is not valid.

       [EFAULT]       The status or rusage arguments point to an illegal address.

See Also
       exit(2), ptrace(2), sigvec(2)

																	   wait(2)
All times are GMT -4. The time now is 06:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy