Bug 4570 - RPC client memory leak
RPC client memory leak
Status: CLOSED NEXTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
6.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Cristian Gafton
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-08-17 09:42 EDT by Aric
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-08-18 11:47:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Aric 1999-08-17 09:42:12 EDT
When I write a simple RPC client/server application, the
client has a memory leak of 336 bytes per
clnt_create()/clnt_destroy() pair.  I am using glibc-2.1.1-6
and glibc-devel-2.1.1-6.

The program does not exhibit this behavior on a Solaris
machine, nor does it exhibit this behavior on an older
RedHat 5.2 machine (with glibc-2.0.7-29).  If I compile with
dynamic linking on RedHat 5.2 and run it on RedHat 6.0, the
leak occurs.  If I link statically on RedHat 5.2 and run it
on RedHat 6.0, the leak does not occur.  Looks like a glibc
problem.

The output is shown at the end for the glibc-2.1.1-6 (RedHat
6.0) version.

Here is the buggy.x rpcgen file that I'm using:
-----------------8<------------------------------
program BUGGY_IFACE {
    version BUGGY_IFACE_VER {
        long test_long(long) = 1;
    } = 1;
} = 0x3123456;
-------------------8<----------------------------
The server is the default one produced with 'rpcgen -a', but
the client I am using is as follows:
-------------------8<------------------------------
#include "buggy.h"
#include <malloc.h>

static void
display_used_memory(void)
{
    struct mallinfo mi;

    mi = mallinfo();
    printf("Used memory: %u\n", mi.usmblks + mi.uordblks);
}

void
buggy_iface_1(char *host)
{
    CLIENT *clnt;

    printf("Before clnt_create: ");
    display_used_memory();

    clnt = clnt_create (host, BUGGY_IFACE, BUGGY_IFACE_VER,
"udp");
    if (clnt == NULL) {
        clnt_pcreateerror (host);
        exit (1);
    }

    printf("Before clnt_destroy: ");
    display_used_memory();

    clnt_destroy (clnt);

    printf("After clnt_destroy: ");
    display_used_memory();
}


int
main (int argc, char *argv[])
{
    while(1) {
        buggy_iface_1 ("localhost");
        sleep(1);
    }
    exit (0);
}
-------------------------8<------------------------
Here is the output:
Before clnt_create: Used memory: 0
Before clnt_destroy: Used memory: 21860
After clnt_destroy: Used memory: 4140
Before clnt_create: Used memory: 4140
Before clnt_destroy: Used memory: 22196
After clnt_destroy: Used memory: 4476
Before clnt_create: Used memory: 4476
Before clnt_destroy: Used memory: 22532
After clnt_destroy: Used memory: 4812
Before clnt_create: Used memory: 4812
Before clnt_destroy: Used memory: 22868
After clnt_destroy: Used memory: 5148
Before clnt_create: Used memory: 5148
Before clnt_destroy: Used memory: 23204
After clnt_destroy: Used memory: 5484
Before clnt_create: Used memory: 5484
Before clnt_destroy: Used memory: 23540
After clnt_destroy: Used memory: 5820
...
Comment 1 Jeff Johnson 1999-08-18 11:47:59 EDT
Upgrade to the Raw Hide glibc packages. Your test program does not
leak on my ultrasparc with glibc-2.1.2-5.

Note You need to log in before you can comment on or make changes to this bug.