in reply to Leaks

If you keep storing (new) information in %name_cache, you'll eventually end up with a huge hash. The rate of growth depends on your cache hit rate. I believe Sriram Srinivasan's Advanced Perl Programming or perlguts gives a pretty good idea of how many bytes of memory each bucket in the hash consumes. (64 bytes sticks out in my mind, but that's just a rough guess and possibly very wrong.)

I would suggest limiting the number of entries you store. Tie::Cache::LRU or Tie::CacheHash might come in handy there.

Replies are listed 'Best First'.
RE (tilly) 2: Leaks
by tilly (Archbishop) on Sep 04, 2000 at 06:50 UTC
    Indeed there is. Install Memoize (ware the joke) and then take a look at Memoize::Expire.

    Actually don't just beware of the joke. Stop and think about what it says for a bit. (That is why it is there after all.) It is actually pretty scary when you think about what you probably just did as root. (Install it if you have no idea what I am talking about.)

RE: Re: Leaks
by jettero (Monsignor) on Sep 04, 2000 at 08:02 UTC
    Actually I'm pretty sure it isn't the name cache that's the problem. This function is called with the same 10 or 20 names over and over. Besides, when I re-wrote it there was no memory leak--but I still used the name cache.

    I am going to look at some of the packages you (chromatic) and tilly suggested so far though!