02-20-2006
Why not create a SIGTERM signal handler that does a graceful exit? Graceful meaning you call an atexit() handler to clean up memory.
kill -9 is generally a bad idea. Even if you don't write an exit handler, do not use
SIGKILL (kill -9) because it can prevent any further operations by the system on behalf of the process. The process leaves junk behind when this happens.
9 More Discussions You Might Find Interesting
1. AIX
Hi,
Would any one be so kind to explain me :
are ulimits defined for each user seperately ? When ?
Specialy what is the impact of :
max locked memory
and
virtual memory
on performance of applications for a user.
Many thanks.
PS :
this is what I can see in MAN :
ulimit ]
... (5 Replies)
Discussion started by: big123456
5 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
Does anyone know what the best commands in the UNIX command line are for obtaining this info:
current CPU usage
memory usage
virtual memory usage
preferably with date and time parameters too?
thanks
ocelot (4 Replies)
Discussion started by: ocelot
4 Replies
3. Programming
I have this code...
#include <stdio.h>
#include <iostream>
#include <pthread.h>
static void* cliente(void *datos);
int main()
{
pthread_attr_t tattr;
int ret;
size_t size = PTHREAD_STACK_MIN + 0x0100;
ret = pthread_attr_init(&tattr);
ret =... (8 Replies)
Discussion started by: JEscola
8 Replies
4. UNIX for Advanced & Expert Users
helo frnds,
I am using RHEL5 and C lang for development.
I am getting some memory leak problem in pthread.
I hav developed a program which creates two threads for listening purpose on two diff ports. both the child threads are doing same job but on diff port no.
I am using... (4 Replies)
Discussion started by: mindTeaser
4 Replies
5. IP Networking
Hi All,
my client server application can work in two modes:
1) one direction - only client sends msgs to server
2) two directions - server gives 'answers' to client.
when program run in the first mode it looks OK, but when server answers to client than client's application exit its... (2 Replies)
Discussion started by: lenna
2 Replies
6. Programming
Hi,
I am trying a database server which keeps a B+ plus tree structure and works on it.
I am trying to find the memory used/leak while executing this process.
I check the memory leak by using ps uax command.
When i execute a delete query i am sure that my code frees up the existing... (9 Replies)
Discussion started by: kumaran_5555
9 Replies
7. Red Hat
Hi all
I am using RED HAT 5.4, and i am getting memory uses problem. when i use "sync;echo 3 > /proc/sys/vm/drop_cache" command the memory will release after 2,3 hour memory show 95%.
pls suggest right way.
thanks (37 Replies)
Discussion started by: reply.ravi
37 Replies
8. Programming
I have written this code in C which reads a very large collection of text files and does some processing. The problem with this code is that there are memory leaks which I am not able to figure out as to where the problem is. When I run this code, and see the memory usage using top command, then I... (7 Replies)
Discussion started by: shoaibjameel123
7 Replies
9. Web Development
Hi
We have just got a dedicated server with Fasthosts, O/S is Linux CentOS 6 64 bit.
It was a fresh install and I have just moved one WordPress site onto there.
The problem is we seem to be getting a memory leak (that's what Fasthosts said) and the database (I think) keeps crashing, so we... (3 Replies)
Discussion started by: Pokeyzx
3 Replies
LEARN ABOUT ULTRIX
pfm_cleanup
pfm_cleanup(3ncs) pfm_cleanup(3ncs)
Name
pfm_cleanup - establish a clean-up handler
Syntax
#include <idl/c/base.h>
#include <idl/c/pfm.h>
status_$t pfm_$cleanup(cleanup_record)
pfm_$cleanup_rec *cleanup_record;
Arguments
cleanup_record A record of the context when is called. A program should treat this as an opaque data structure and not try to alter
or copy its contents. It is needed by and to restore the context of the calling process at the clean-up handler entry
point.
Description
The routine establishes a clean-up handler that is executed when a fault occurs. A clean-up handler is a piece of code executed before a
program exits when a signal is received by the process. The clean-up handler begins where is called; the routine registers an entry point
with the system where program execution resumes when a fault occurs. When a fault occurs, execution resumes after the most recent call to
There can be more than one clean-up handler in a program. Multiple clean-up handlers are executed consecutively on a last-in/first-out
basis, starting with the most recently established handler and ending with the first clean-up handler. The system provides a default
clean-up handler established at program invocation. The default clean-up handler is always called last, just before a program exits, and
releases any system resources still held, before returning control to the process that invoked the program.
Diagnostics
When called to establish a clean-up handler, returns the status pfm_$cleanup_set to indicate the clean-up handler was successfully estab-
lished. When the clean-up handler is entered in response to a fault signal, effectively returns the value of the fault that triggered the
handler.
This section lists status codes for errors returned by this routine in
pfm_$bad_rls_order Attempted to release a clean-up handler out of order.
pfm_$cleanup_not_found
There is no pending clean-up handler.
pfm_$cleanup_set A clean-up handler was established successfully.
pfm_$cleanup_set_signaledl
Attempted to use pfm_$cleanup_set as a signal.
pfm_$invalid_cleanup_rec
Passed an invalid clean-up record to a routine.
pfm_$no_space Cannot allocate storage for a clean-up handler. Clean-up handler code runs with asynchronous faults inhibited. When
returns something other than pfm_$cleanup_set indicating that a fault has occurred, there are four possible ways to
leave the clean-up code:
o The program can call to start the next clean-up handler with a different fault signal.
o The program can call to start the next clean-up handler with the same fault signal.
o The program can continue with the code following the clean-up handler. It should generally call to reenable
asynchronous faults. Execution continues from the end of the clean-up handler code; it does not resume where
the fault signal was received.
o The program can reestablish the handler by calling before proceeding.
Files
See Also
intro(3ncs), pfm_signal(3ncs)
pfm_cleanup(3ncs)