[tpop3d-discuss] possible memory leak with Perl authentication

Christopher E. Stith mischief at motion.net
Fri, 7 Dec 2001 17:40:14 -0600


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
seven minutes at first, then it seems to slow down, but still grows.
This is with just five hundred and ten or so boxes on the system, so
if it depends upon accesses, I'd hate to see it when I move my other
eleven to twelve thousand boxes to it from where they currenly sit.

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
re-entered and the fact that tpop3d uses an embedded compiler and
bytecode interpeter for the language. I haven't sifted through the
code enough to be sure, but it stands to reason looking at the
system as a black box that Perl could be grabbing memory each
authentication. I've tried undef()ing my lexicals when through with
them.

I haven't run the server under Purify or anything just yet, as I was
wanting to know if there are any known issues of this sort. I'd be
happy to share my (rather crufty) authentication subs with the list
if that would help.

If there's a known issue with a memory leak, please let me know.
If there's a problem with memory leaks, I'd still be hard-pressed to
find anything that works as well for my needs. I love the multiple
authentication methods, the virtual domain support, and the fact that
with the two combined I can make it work with overlapping user names
among the different virtual domains. Perhaps a quick fix would be for
me to just put an exec() in the main loop that triggers every eight
hours or so and re-executes the server. Hundreds of simultaneous
connections to something using over five megs per connection is not
going to be a workable option on a machine with a gig of ram, or even
two, which unfortunately is the max this server I've been given to
work with can hold.

Any code tweaks, suggestions, or discussion leading to ideas on how to
solve this would be greatly appreciated. It's a great program, and I
really want to stick with it. Unfortunately, I'm quite rusty with C,
so I'd need to brush off my back brain to do more than quick fixes
myself. If it's a problem with my Perl code, I'd like to know that too.
I code in Perl daily, but not very often with an interpreter embedded
in another program, so I might be missing something peculiar to that.

Thanks a lot for the project, Mr. Lightfoot and everyone else involved.

Chris Stith
Technical Operations Manager
Motion Internet
mischief@motion.net

-- 
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.