Sponsored Content
Full Discussion: Memory LEAK with pthreads
Top Forums Programming Memory LEAK with pthreads Post 302314062 by fpmurphy on Thursday 7th of May 2009 10:03:38 AM
Old 05-07-2009
Where and how are you checking memory usage? It is unclear from your message.
After the threads are created? After the program exits?

Some minor things are obvious. The unused pthread_t (401 v 400), and no call to pthread_attr_destroy() after creating the set of threads.
 

9 More Discussions You Might Find Interesting

1. Programming

about virtual memory and memory leak

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

Problem with POSIX pthreads and virtual memory

Hi, i have this code... in order to test my problem... #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 =... (8 Replies)
Discussion started by: JEscola
8 Replies

3. UNIX for Advanced & Expert Users

Memory leak while using pthread_cancel()

I tried to execute a sample pthread program to cancel a newly created one using pthread_cancel(). but using valgrind on my code shows some memory leak. My Code: #include "iostream" #include "unistd.h" #include "pthread.h" #include "signal.h" using namespace std; void handler(int); void*... (4 Replies)
Discussion started by: kcr
4 Replies

4. UNIX for Advanced & Expert Users

Need to create a memory leak

Hi. This might be a strange request, but does anyone have any idea on a simple shell script that would use more and more memory as it ran? Like a purposeful leak. I want to test the behaviour of an already running program when the machine runs out of memory. Thanks! (4 Replies)
Discussion started by: rebelbuttmunch
4 Replies

5. IP Networking

memory leak?

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

memory leak problem

hi all Can any one plz explain me about memory leak problem Thankx (5 Replies)
Discussion started by: sonali
5 Replies

7. Programming

Memory Leak

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

8. Red Hat

Memory leak

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

9. Programming

Help regarding memory leak in this C program

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
pthread_attr_init(3C)													     pthread_attr_init(3C)

NAME
pthread_attr_init, pthread_attr_destroy - initialize or destroy threads attribute object SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ] #include <pthread.h> int pthread_attr_init(pthread_attr_t *attr); int pthread_attr_destroy(pthread_attr_t *attr); The function pthread_attr_init() initializes a thread attributes object attr with the default value for all of the individual attributes used by a given implementation. The resulting attribute object (possibly modified by setting individual attribute values), when used by pthread_create(), defines the attributes of the thread created. A single attributes object can be used in multiple simultaneous calls to pthread_create(). The pthread_attr_init() function initializes a thread attributes object ( attr) with the default value for each attribute as follows: Attribute Default Value Meaning of Default contentionscope PTHREAD_SCOPE_PROCESS resource competition within process detachstate PTHREAD_CREATE_JOINABLE joinable by other threads stackaddr NULL stack allocated by system stacksize NULL 1 or 2 megabyte priority 0 priority of the thread policy SCHED_OTHER determined by system inheritsched PTHREAD_EXPLICIT_SCHED scheduling policy and parameters not inherited but explicitly defined by the attribute object guardsize PAGESIZE size of guard area for a thread's created stack The pthread_attr_destroy() function destroys a thread attributes object ( attr), which cannot be reused until it is reinitialized. An implementation may cause pthread_attr_destroy() to set attr to an implementation-dependent invalid value. The behavior of using the attribute after it has been destroyed is undefined. Upon successful completion, pthread_attr_init() and pthread_attr_destroy() return a value of 0. Otherwise, an error number is returned to indicate the error. The pthread_attr_init() function will fail if: ENOMEM Insufficient memory exists to initialize the thread attributes object. The pthread_attr_destroy() function may fail if: EINVAL attr is invalid. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ sysconf(3C), pthread_attr_getdetachstate(3C), pthread_attr_getguardsize(3C), pthread_attr_getinheritsched(3C), pthread_attr_getsched- param(3C), pthread_attr_getschedpolicy(3C), pthread_attr_getscope(3C), pthread_attr_getstackaddr(3C), pthread_attr_getstacksize(3C), pthread_attr_setdetachstate(3C), pthread_attr_setguardsize(3C), pthread_attr_setinheritsched(3C), pthread_attr_setschedparam(3C), pthread_attr_setschedpolicy(3C), pthread_attr_setscope(3C), pthread_attr_setstackaddr(3C), pthread_attr_setstacksize(3C), pthread_cre- ate(3C), attributes(5), standards(5) 23 Mar 2005 pthread_attr_init(3C)
All times are GMT -4. The time now is 10:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy