Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8121529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:31:16+00:00 2026-06-06T05:31:16+00:00

gurus. I have a perl script which needs to run in an infinite loop

  • 0

gurus.

I have a perl script which needs to run in an infinite loop and monitor my gnu/linux’s load average and free ram and send an email using google’s account if the load/ram is above/below the value set.

i found these

Memory usage of Perl script

How can I find memory leaks in long-running Perl program?

and have done as suggested to use undef but that doesn’t seems to help as most likely I have something that never gets cleared/freed.

here’s a sample of how the memory usage is constantly increasing and after a day it can allocate quite much ram.

Here’s the perl script itself. Can someone point me somewhere on how to fix this. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:31:18+00:00Added an answer on June 6, 2026 at 5:31 am

    Apart from using cron, there are plenty of system monitoring tools that do all this sort of stuff for you.

    Anyway – it’ll be easier to check where memory is being used if you write some subroutines along the lines of:

    while (1) {
      my $cpu = ...
      my $stat = ...
      if (need_to_send_msg($cpu, $stat)) { send_message($cpu,$stat) }
    }
    
    sub send_message {
      my ($cpu, $stat) = @_;
      my $msg_body = compose_message($cpu, $stat);
      transmit_message($msg_body, $from, $to);
    }
    

    That will remove a whole bunch of variables from the main body of your script and let you comment out parts of the subroutines to see where memory is used.

    Oh – it looks to me as though you are constantly creating $smtp connections even if you aren’t going to send a message. It’d be easier to be sure once you’ve got the main loop smaller by using some subroutines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi Javascript gurus, I have this Javascript code which is working fine on Firefox
need help from some gurus here, I have a database which I have moved
I have a question for the Low-level networking/Linux gurus, I have to build two
Calling all MQ Gurus, I have a box under my desk which we use
Unix gurus! I have a Java program which passes some parameters to a Servlet
Gurus of SO I have a working web app which works well enough with
Gurus, I have coded for my client a PHP script that performs some extensive
I need some help from the shell-script gurus out there. I have a .txt
I have quick question for you SQL gurus. I have existing tables without primary
LINQ gurus, I am looking for help to write a query... I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.