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 6059423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:42:31+00:00 2026-05-23T08:42:31+00:00

I have just discovered a nasty memory leak using both each_array() and each_arrayref() from

  • 0

I have just discovered a nasty memory leak using both each_array() and each_arrayref() from List::MoreUtils.

These three lines of code are part of a subroutine executed four thousand times on each run.
My objective is to give proper format to values already in a hash. I have a fixed number of hash keys and a format string for each hash key.

my %hash = ();
# ...
my $two_arrays = each_arrayref( $field_list, $field_list_format );
while ( my ( $field, $format ) = $two_arrays->() ) {
    $hash{ $field } = sprintf $format, $hash{ $field };
}

If I stick a return; before my $two_arrays ..., the leak disappears. The same return; past the last line makes the leak.

Since the subroutine is part of a daemon program, I noticed the continuous growth of memory ( both VIRT and RES ).

There is something I did wrong? Is there is any memory leak of each_array() or each_arrayref(), I’m not aware of?

  • List::MoreUtil ( VERSION 0.22 )
  • Perl 5.12.1 ( x86_64 with threads ) on Linux 2.6.32-32-generic ( Ubuntu 10.04 )
  • 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-05-23T08:42:31+00:00Added an answer on May 23, 2026 at 8:42 am

    List::MoreUtil ( VERSION 0.22 ) is dated July 2006, 5 years ago. The current version is 0.32, is the leak still present in this version? There have been several memory leaks fixed in the last few versions: http://cpansearch.perl.org/src/ADAMK/List-MoreUtils-0.32/Changes

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

Sidebar

Related Questions

I have just discovered this feature. Declaring an interface using the @interface syntax allows
I have just discovered a package for R to retrieve abstract from pubmed, which
I'm using LINQTOSQL and have just discovered I'm stuck with storing things in one
I'm using FDT and Flash 10, and have just discovered Flixel , but when
I have just discovered the nifty unhandled exception handler for cocoa-touch. Now that I
I have just discovered that if generating assemblies via Reflection.Emit, the .NET framework keeps
I have just discovered a variable name that is misspelled. If it were hidden
I have just recently discovered how much I enjoy developing code the TDD way:
I just discovered the what c# knowledge should I have? question and wondered about
I have a website, and I just discovered that somehow someone injected JavaScript on

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.