in reply to How often should I flush?

Flush when you're done.

No seriously, I mean it. If you run out of memory, Perl will be sure to kick the bucket and say "Out of memory!" You shouldn't worry about it too much- it doesn't hurt anything. If you find that after some X iterations, your script runs out of memory, take note of it, insert a courtesy flush at this point, and strike a match.

AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.

Replies are listed 'Best First'.
Re: Re: How often should I flush?
by elusion (Curate) on Feb 20, 2001 at 06:04 UTC
    The point is that I don't want that to happen. I want it to be running 24/7. I'm only home for a few hours, so if it stops sometime else I lose hours of data. I want to prevent that. Is there a way to detect when Perl's just about out of memory?

    - p u n k k i d
    "Reality is merely an illusion, albeit a very persistent one." -Albert Einstein

      If you really are concerned, write a script and use vmstat(see the man page, but *Always* ignore the first line of output from vmstat) to watch the memory use of the program and have it issue some "flush" command to your program if it reaches a certain threshold. That way you can enjoy not having to make the program have to worry about it, but also not need to worry about missing the event if it happens.
      "A man's maturity -- consists in having found again the seriousness one had as a child, at play." --Nietzsche