Ask a Question related to AIX, Design and Development.
-
Sanjeev #1
pthreads memory leak in AIX 4.3.3.0?
Hi,
I am seeing a memory leak while using pthreads in AIX 4.3.3.0. The
following example program which simply creates a thread and joins it
shows an increase in RSS as well as SIZE (4 KB in about 30 minutes).
The values were measured using the ps v <pid> command.
/* Build command: /bin/xlC -o memleak -g -+ -DTHREAD_SAFE -DAIX
memleak.c */
#if defined(AIX)
#include <pthread.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#if defined(AIX)
#include <errno.h>
#include <sys/errno.h>
#include <sys/wait.h>
#include <fcntl.h>
#endif
void *receiver (void *);
int main (int argc, char *argv [])
{
pthread_t r_th;
int errno;
void* status;
while (1) {
if (pthread_create (&r_th, NULL, receiver, NULL) < 0) {
fprintf (stderr, "ERROR: pthread_crate: errno = %d\n", errno);
exit (0);
}
printf ("thread started ..\n");
pthread_join(r_th, &status);
}
}
void *receiver (void *token)
{
void *thread_end = NULL;
char buf [2048];
buf [0] = '1';
buf [2047] = '9';
printf ("thread starting: %d\n", pthread_self() );
sleep (1);
printf ("thread ending: %d\n", pthread_self() );
pthread_exit (NULL);
return NULL;
}
Creating the thread after setting its attribute to detached also does
not help.
From the discussion [url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&th=c052cfe587cd581e[/url]
I understand that there was a pthreads memory leak issue in AIX
4.3.2.0 that got fixed in 4.3.3.0. But I am running AIX 4.3.3.0 and
still seeing a leak.
The pthreads library I am using is:
bos.rte.libpthreads 4.3.3.77
Do you know what I am doing wrong and how to correct it? I have to
find a solution in 4.3.3.0 itself because I can't upgrade to a higher
AIX version right now.
Thanks,
Sanjeev
Sanjeev Guest
-
#39438 [NEW]: Memory leak PHP Fatal error: Out of memory
From: nikolas dot hagelstein at gmail dot com Operating system: NETBSD 3.0.1 AMD64 PHP version: 5.2.0 PHP Bug Type: ... -
memory problem/memory leak
Hi I have a problem with shockwave player running in Internet Explorer. My program consists of a controller movie which loads in content files in... -
big memory leak
Hi there, Our project, wich needs to be deployed 24/7 in lots of terminals, is experiencing a big memory leak. Would like to know about best... -
Memory consumption of Ruby/mod_ruby combo on Apache [memory leak]
> I don't think so - I think all the modules are loaded when Apache is It didn't have anything to do with IfModules or even Apache. I had a... -
Memory Leak?
I am watching the "Mem Usage" for the sqlserver.exe process in the Windows NT Task Manager climb at a rate of about 400k per minute. This has been... -
RobH #2
Re: pthreads memory leak in AIX 4.3.3.0?
"Sanjeev" <sanjvkoz@yahoo.com> wrote in message
news:db9aecfd.0309240208.51f8d4c7@posting.google.c om...[url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&th=c052cfe58[/url]> Hi,
>
> I am seeing a memory leak while using pthreads in AIX 4.3.3.0. The
> following example program which simply creates a thread and joins it
> shows an increase in RSS as well as SIZE (4 KB in about 30 minutes).
> The values were measured using the ps v <pid> command.
>
> /* Build command: /bin/xlC -o memleak -g -+ -DTHREAD_SAFE -DAIX
> memleak.c */
> #if defined(AIX)
> #include <pthread.h>
> #endif
> #include <stdio.h>
> #include <stdlib.h>
> #include <signal.h>
> #if defined(AIX)
> #include <errno.h>
> #include <sys/errno.h>
> #include <sys/wait.h>
> #include <fcntl.h>
> #endif
>
> void *receiver (void *);
>
>
> int main (int argc, char *argv [])
> {
> pthread_t r_th;
> int errno;
> void* status;
>
> while (1) {
> if (pthread_create (&r_th, NULL, receiver, NULL) < 0) {
> fprintf (stderr, "ERROR: pthread_crate: errno = %d\n", errno);
> exit (0);
> }
> printf ("thread started ..\n");
> pthread_join(r_th, &status);
> }
> }
>
> void *receiver (void *token)
> {
> void *thread_end = NULL;
> char buf [2048];
>
> buf [0] = '1';
> buf [2047] = '9';
> printf ("thread starting: %d\n", pthread_self() );
> sleep (1);
> printf ("thread ending: %d\n", pthread_self() );
> pthread_exit (NULL);
> return NULL;
> }
>
> Creating the thread after setting its attribute to detached also does
> not help.
>
> From the discussion
7cd581eTry the latest version> I understand that there was a pthreads memory leak issue in AIX
> 4.3.2.0 that got fixed in 4.3.3.0. But I am running AIX 4.3.3.0 and
> still seeing a leak.
>
> The pthreads library I am using is:
> bos.rte.libpthreads 4.3.3.77
[url]ftp://ftp.boulder.ibm.com/aix/fixes/v4/os/bos.rte.libpthreads.4.3.3.82.b[/url]
ff
>
> Do you know what I am doing wrong and how to correct it?
> I have to
> find a solution in 4.3.3.0 itself because I can't upgrade to a higher
> AIX version right now.
--
RobH
The future's dim, the future's mono.
RobH Guest



Reply With Quote

