[tpop3d-discuss] possible memory leak with Perl authentication

Christopher E. Stith mischief at motion.net
Fri, 7 Dec 2001 21:32:30 -0600

I think I've figured something out, playing with my Perl code and
applying Mr. Lightfoot's suggestions.

Thus spake Chris Lightfoot (chris@ex-parrot.com):

> On Fri, Dec 07, 2001 at 05:40:14PM -0600, Christopher E. Stith wrote:
> > I've recently installed tpop3d with a custom Perl authenticator
> > for my virtual domain POP3 server. It works rather well, but I
> > have a memory concern.
> > 
> > When the process starts, it's around 2.3 megs. After four days, it
> > was about 5.6 megs. It starts going up in 4k chunks every five to


4k is about the size Perl allocates when it needs more filehandles and
all the data it keeps with those. I know this from a server project I
worked on some time ago. I'm opening files from within the Perl code,
and I had forgotten to close them anywhere. Now they are being closed
after use.
> > It has occurred to me that it could be due to Perl's habit of
> > holding on to lexical memory for a scope in case the scope is

I think I was only a bit off here.

> I'm not going to pretend that tpop3d is guaranteed free of
> memory leaks. Certainly some have existed in the past,

I wouldn't expect that, but again I think this isn't the C code,
but rather a Perl issue, and in this case my Perl issue especially.

> though all the ones I know about were fixed in a previous
> release. I'm not aware of any auth-perl specific problems,
> but I don't know how widely it is used. The tpop3d
> installations I run don't use it.

I'll keep you posted, but I think this should make a difference. Your
sugegstion to use the Perl code through auth-other helped me look in
the right places.

Did I mention before that I absolutely _love_ tpop3d? I was afraid I'd
have to get out my K&R or Soustroup to customize a POP3 server to this
site's needs. It's your work, Chris, that's letting the rest of us off
easy. Thanks for releasing tpop3d under the GNU GPL. I, for one, really
appreciate it. From the looks of the list archives, I'm far from the only

Christopher Stith
Motion Internet

For the pleasure of others, please adhere to the following
rules when visiting your park:
    No swimming.  No fishing.  No flying kites.  No frisbees.
    No audio equipment. Stay off grass.  No pets. No running.