Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 4657 - memory leak in gethostbyname() when (not) using NIS+
memory leak in gethostbyname() when (not) using NIS+
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Cristian Gafton
Depends On:
  Show dependency treegraph
Reported: 1999-08-22 22:45 EDT by antonyn
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1999-08-23 10:31:00 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 antonyn 1999-08-22 22:45:04 EDT

I am running RH6.0 + updates on an x86 machine.  This box is
networked and uses NIS to sync accounts across our network.

The problem arises when code like the following is run on a
RH6 machine with the default NIS installation:

#include <stdio.h>
#include <netdb.h>
int main() {
   while (1) {
      struct hostent* pHostEnt = NULL ;
      pHostEnt = gethostbyname("www.redhat.com");
  return 0 ;

Note that using gethostbyname_r has the same problem (I did
a search on deja.com, and Theodore Tso mentioned that using
the standard gethostbyname is prone to memory leaks.)

Running this program and watching it in top will show that
the process will continually eat memory until it severely
bogs down the machine.  The problem is glibc-related, but it
is actaully triggered with RH's default NIS setup.  The
"hosts:" entry in /etc/nsswitch.conf has 'nisplus' listed
before 'dns' - I'm guessing the leak starts here, as
switching the order (ie, having 'dns' listed before
'nisplus' on a network setup that queries a valid DNS
server) will fix the problem.

Comment 1 antonyn 1999-08-22 22:53:59 EDT
Hello, I just found this URL on deja.com which sheds more light.
Perhaps it's time for a new glibc RPM release?

Comment 2 antonyn 1999-08-22 22:55:59 EDT
One last note - my friend runs the latest Mandrake which includes this
version of glibc; he's a huge Mandrake advocate.  We can't have RH be
behind Mandrake in bugfixes now, can we? ;)
Comment 3 Jeff Johnson 1999-08-23 10:31:59 EDT
Memory leaks in NIS code are fixed in the Raw Hide glibc.

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