02-20-2006
I have a C program that I suspect of memory leak.
However, the memory leak occurs when I kill -9 the program and restart the program to run as a daemon.
I didn't see the memory leak problem when the daemon is not killed and restarted at least 5 times.
The CPU usage on the server drop to ZERO everytime I kill the process BUT whenever I restart the process, it consume 2% more than it did the previous time.
Is this possible? I dun understand why did the CPU util dropped to ZERO after I kill the porcess if it is a memory leak.
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 BSD
shm_overview
SHM_OVERVIEW(7) Linux Programmer's Manual SHM_OVERVIEW(7)
NAME
shm_overview - overview of POSIX shared memory
DESCRIPTION
The POSIX shared memory API allows processes to communicate information by sharing a region of memory.
The interfaces employed in the API are:
shm_open(3) Create and open a new object, or open an existing object. This is analogous to open(2). The call returns a file descriptor
for use by the other interfaces listed below.
ftruncate(2) Set the size of the shared memory object. (A newly created shared memory object has a length of zero.)
mmap(2) Map the shared memory object into the virtual address space of the calling process.
munmap(2) Unmap the shared memory object from the virtual address space of the calling process.
shm_unlink(3) Remove a shared memory object name.
close(2) Close the file descriptor allocated by shm_open(3) when it is no longer needed.
fstat(2) Obtain a stat structure that describes the shared memory object. Among the information returned by this call are the
object's size (st_size), permissions (st_mode), owner (st_uid), and group (st_gid).
fchown(2) To change the ownership of a shared memory object.
fchmod(2) To change the permissions of a shared memory object.
Versions
POSIX shared memory is supported since Linux 2.4 and glibc 2.2.
Persistence
POSIX shared memory objects have kernel persistence: a shared memory object will exist until the system is shut down, or until all pro-
cesses have unmapped the object and it has been deleted with shm_unlink(3)
Linking
Programs using the POSIX shared memory API must be compiled with cc -lrt to link against the real-time library, librt.
Accessing shared memory objects via the filesystem
On Linux, shared memory objects are created in a (tmpfs(5)) virtual filesystem, normally mounted under /dev/shm. Since kernel 2.6.19,
Linux supports the use of access control lists (ACLs) to control the permissions of objects in the virtual filesystem.
NOTES
Typically, processes must synchronize their access to a shared memory object, using, for example, POSIX semaphores.
System V shared memory (shmget(2), shmop(2), etc.) is an older shared memory API. POSIX shared memory provides a simpler, and better
designed interface; on the other hand POSIX shared memory is somewhat less widely available (especially on older systems) than System V
shared memory.
SEE ALSO
fchmod(2), fchown(2), fstat(2), ftruncate(2), mmap(2), mprotect(2), munmap(2), shmget(2), shmop(2), shm_open(3), shm_unlink(3), sem_over-
view(7)
COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
Linux 2016-12-12 SHM_OVERVIEW(7)