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
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
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
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
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
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 all
Can any one plz explain me about memory leak problem
Thankx (5 Replies)
Discussion started by: sonali
5 Replies
7. 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
8. 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
9. 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
LEARN ABOUT NETBSD
pthread_attr_get_np
PTHREAD_ATTR_GET_NP(3) BSD Library Functions Manual PTHREAD_ATTR_GET_NP(3)
NAME
pthread_attr_get_np -- get attributes of existing thread
LIBRARY
POSIX Threads Library (libpthread, -lpthread)
SYNOPSIS
#include <pthread.h>
int
pthread_attr_get_np(pthread_t thread, pthread_attr_t *attr);
int
pthread_getattr_np(pthread_t thread, pthread_attr_t *attr);
DESCRIPTION
The pthread_attr_get_np() and pthread_getattr_np() functions can be used to retrieve attributes of a running thread. The result is stored to
attr.
For pthread_attr_get_np() attr should be initialized prior to the call by using pthread_attr_init(3). pthread_getattr_np() does this auto-
matically.
For both functions attr should be freed when it is not in use anymore with pthread_attr_destroy(3).
Most fields of attr are the same ones provided during thread creation time as a parameter to pthread_create(3). The exceptions include:
o The detach state -- a joinable thread may have detached itself after the creation.
o The guard size, which may vary if the application has allocated its own thread stack.
o The stack address and size; pthread_attr_get_np() will always return the thread's real stack address and size, regardless of the
values in the original attributes structure.
The returned pthread_attr_t structure is supposed to be used in conjunction with the pthread_attr_get*() functions to retrieve individual
values from the structure. When the returned attr is no longer needed, it should be destroyed by using pthread_attr_destroy(3).
RETURN VALUES
Upon successful completion, pthread_attr_get_np() and pthread_getattr_np() return 0. Otherwise an error number is returned to indicate the
error.
COMPATIBILITY
The pthread_attr_get_np() and pthread_getattr_np() functions are non-standard extensions.
ERRORS
The pthread_attr_get_np() and pthread_getattr_np() functions will fail if:
[ENOMEM] Insufficient memory.
[ESRCH] Non-existent thread.
SEE ALSO
pthread(3), pthread_attr(3)
BSD
August 6, 2010 BSD