Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I have a CGI script that was made very poorly (back before I knew better) and sucks up way too much memory through calls to Mysql, and downloading lots of pages from the web... and probably lots more. It was never a problem really until usage of the site started to pick up. I have to go in an clean in up, but it may be a while before I get the chance, so I was wondering if there is a way to restrict the memory usage only to that particular program. (and then only when it runs the "bad" routine).

Thanks, Kbean

Replies are listed 'Best First'.
Re: Restricting memory usage
by Marza (Vicar) on Nov 29, 2002 at 06:56 UTC

    What do you consider "way too much memory"

    Why not post some code? That way you can get input on many areas!

      Sorry, it was a dumb question. I meant that it uses too much of the CPU (like 60 - 80% of the entire server's CPU for a single process, and the process lasts for up to 1 minute at times). Should I repost and change the subject?

      I would post the code, but I'm not even at the point of fixing the places that need fixing yet. For now I was just wondering if there is some quick way to regulate it.