[443] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

Cleanup problems with pthreads

daemon@ATHENA.MIT.EDU (Marcos A. Bellezi)
Wed Oct 2 17:51:19 1996

Date: Thu, 1 Aug 1996 18:20:17 -0300 (EST)
From: "Marcos A. Bellezi" <bellezi@sauron.vway.com.br>
To: pthreads@MIT.EDU


I'm developing a very thread intensive program on Linux 2.0 (pthread 
1.60beta5) and I noted that it is very memory hungry. I checked all the code 
to find if I forgot to dealocate something but everything seens right. So, 
I wrote a small program to figure out if the problem is the pthread library. 
If you run this program (with a TOP utilitie on another window) and you go 
pressing ENTER you could note the process will increase its memory usage.
I'm missing something or the library has problems dealocating the memory 
used by the theads ??

The tiny program is:

------------------------------
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>

void * do_nothing(void *)
{
	char msg[1000];  /* only for test storage allocation */ 

	puts("Executed...");
 	pthread_exit(0); 
	return NULL;
}

void main(void)
{
        pthread_t thread;
	char c;

	while(1) {
	c = getchar();
        if (pthread_create(&thread, NULL, dummy, (void *)0xdeadbeef))
                puts("Error: creating new thread");
	}

}
-----------------------------------------

Any clues ??

please send mail to bellezi@vway.com.br

Thanks in advance

[]s
Marcos Bellezi

home help back first fref pref prev next nref lref last post