pthreads memory leak in AIX 4.3.3.0?

Ask a Question related to AIX, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. #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: ...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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...
    > 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=c052cfe58[/url]
    7cd581e
    > 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
    Try the latest version
    [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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139