Bug 4570 - RPC client memory leak
RPC client memory leak
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Cristian Gafton
Depends On:
  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:
Last Closed: 1999-08-18 11:47:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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

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

static void
    struct mallinfo mi;

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

buggy_iface_1(char *host)
    CLIENT *clnt;

    printf("Before clnt_create: ");

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

    printf("Before clnt_destroy: ");

    clnt_destroy (clnt);

    printf("After clnt_destroy: ");

main (int argc, char *argv[])
    while(1) {
        buggy_iface_1 ("localhost");
    exit (0);
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.