Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Apr 1996 13:54:18 -0700 (PDT)
From:      Bill Paul <wpaul>
To:        CVS-committers, cvs-all, cvs-usrsbin
Subject:   cvs commit:  src/usr.sbin/ypserv yp_dblookup.c
Message-ID:  <199604112054.NAA11332@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

wpaul       96/04/11 13:54:17

  Modified:    usr.sbin/ypserv  yp_dblookup.c
  Log:
  Fix for memory leak: specify NULL as openinfo parameter when calling
  dbopen() to open an NIS map.
  
  Testing with very large maps (e.g. a sample password database with 31,000+
  entries) has shown that ypserv will leak memory (ps shows RSS and VSZ
  growing to 4000 pages or more) when performing repeated yp_next()s or
  a yp_all(). The problem with yp_all() is not immediately obvious since
  the ypproc_all service is handled in a child process which exits once
  the transfer is finished, but with repeated yp_next()s (like what you
  get when you use getpwent() to scroll through the password database),
  the parent ypserv grows to enormous size and never shrinks again.
  
  It seems this is related to the HASHINFO parameters I used in yp_dblookup.c,
  which I actually stole from pwd_mkdb. Calling dbopen() with the default
  parameters (specifying openinfo as NULL) fixes the problem.
  
  I still need to see how this impacts the other NIS tools. I'm also
  considering changing from hash to btree databases: the hash database
  method doesn't support R_CURSOR, which means yp_next_record() has to
  do a lot of ugly work in order to reach an arbitrary location in the
  database.
  
  Revision  Changes    Path
  1.4       +2 -2      src/usr.sbin/ypserv/yp_dblookup.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604112054.NAA11332>