05-08-2008
Ok found it!
Hello all!
I found the cause for it..
Quote:
Note - When there is no explicit synchronization to prevent it, a newly created, detached thread can die and have its thread ID reassigned to another new thread before its creator returns from pthread_create(). For nondetached (PTHREAD_CREATE_JOINABLE) threads, it is very important that some thread join with it after it terminates -- otherwise the resources of that thread are not released for use by new threads. This commonly results in a memory leak. So when you do not want a thread to be joined, create it as a detached thread.
(from
Further Threads Programming:Thread Attributes (POSIX))
When i initialized the threadattr whit the parameter PTHREAD_CREATE_DETACHED there was no memory leak anymore!
!!!!!
*just to remember that this socket implementation is not a good one for producing, since it creates one thread per each new connection accepted...
The best way to implemented is to limit a maximum number of connections.
9 More Discussions You Might Find Interesting
1. Programming
Hi,
First of all I appreciate this group very much for its informative discussions and posts.
Here is my question.
I have one process whose virtual memory size increases linearly from 6MB to 12MB in 20 minutes. Does that mean my process has memory leaks?
In what cases does the... (4 Replies)
Discussion started by: shriashishpatil
4 Replies
2. Programming
In our concurrent tcp server program, once the connection comes, the program create a thread to process acception. When the client exit, the server closed socket and the thread exited, the problem is the memory can not release normally. The code looks like the followings:
main()
{
... (1 Reply)
Discussion started by: Frank2004
1 Replies
3. UNIX for Advanced & Expert Users
i am creating threads in my program using the POSIX interface.
when the thread starts executing i run out of memory and get a core dump.
i have tried to increase the threads stack size using pthread_attr_setstacksize, but of no use since i guess the dynamic memory is allocated on the heap and... (1 Reply)
Discussion started by: aniketkadu2002
1 Replies
4. 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
5. 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
6. 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
7. Programming
I want to create a program that creates 2 child process, and each of them creates 2 threads, and each thread prints its thread id. I0ve allread done that the outuput isn't the outuput i want.
When a run the following comand "$./a.out | sort -u | wc -l" I have the folowing output
2
$:
It should... (3 Replies)
Discussion started by: pharaoh
3 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 OSF1
tis_setspecific
tis_setspecific(3) Library Functions Manual tis_setspecific(3)
NAME
tis_setspecific - Changes the value associated with the specified thread-specific data key.
LIBRARY
Standard C Library (libc.so, libc.a)
SYNOPSIS
#include <tis.h>
int tis_setspecific(
pthread_key_t key,
const void *value);
STANDARDS
None
PARAMETERS
Thread-specific data Key that identifies the data to receive value. Must be obtained from a call to tis_key_create(3). New value to asso-
ciate with the specified key. Once set, this value can be retrieved using the same key in a call to tis_getspecific(3).
DESCRIPTION
This routine sets the value associated with the specified thread-specific data key. If a value is defined for the key (that is, the current
value is not NULL), the new value is substituted for it. The key is obtained by a previous call to tis_key_create(3).
Do not call this routine from a data destructor function. Doing so could lead to a memory leak or an infinite loop.
RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Successful completion. The value specified by key is not a valid key. Insufficient memory exists to associate the value with the key.
ERRORS
None
RELATED INFORMATION
Functions: tis_getspecific(3), tis_key_create(3), tis_key_delete(3)
Manuals: Guide to DECthreads and Programmer's Guide
delim off
tis_setspecific(3)