in reply to Finding memory leaks

I've always had the feeling that long running applications are prone to problems like this and try to avoid them. My workaround is to have the script in a cron job which is called every minute. It basically wakes up, checks to see if there are less than a certain amount of itself running, grabs a set of tasks (and marks them as in progress), processes them, logs action, and then marks them as complete.

Lately I've been wondering if there are any disadvantages to this method, but I can't seem to think of any (bar the script start up costs). Obviously this isn't applicable for any networking based daemons.

gav^

Replies are listed 'Best First'.
Rex2: Finding memory leaks
by Sweeper (Pilgrim) on Apr 25, 2002 at 05:40 UTC
    One disadvantage could be variable persistence. If you need to remember a variable for the whole duration of the task, you will have to store this variable in a permanent file (with Storable or similar module) and retrieve it later. With possible security problems.

    I think in your case, you are lucky not to need persistence. In your case, a cron job is good enough to prevent memory leaks.