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

  • Home
  • SEARCH
  • 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 7081989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:59:25+00:00 2026-05-28T06:59:25+00:00

My code looks like: my %var; my %var_new={}; while(1){ while(my ($k,$v)=each %var){ &a_sub($v); }

  • 0

My code looks like:

 my %var;
 my %var_new={};

 while(1){
     while(my ($k,$v)=each %var){
            &a_sub($v);
     }
     %var={}; # A
     map { $var{$_}=$var_new{$_}; } keys %var_new;
     %var_new={}; # B
 }

 sub a_sub { #....} # will fill %var_new

My program’s memory usage goes up and up.

It seems Perl doesn’t free memory at Line A and Line B.

How can I manually make Perl to free up memory used %var and %var_new?

  • 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-28T06:59:25+00:00Added an answer on May 28, 2026 at 6:59 am

    IIRC, once Perl has allocated memory from the operating system, it holds onto that memory for the life of the process. Where possible, Perl will reuse memory it has already allocated rather than ask the operating system for more, but you won’t see the memory used by a process decrease.

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

Sidebar

Related Questions

The Async Tracking code in Google Analytics looks like this: var _gaq = _gaq
I've got a chunk of code that looks like this: var task = Task.Factory.StartNew(()
I've got a chunk of code that looks like this: var task = Task.Factory.StartNew(()
The code looks like below: namespace Test { public interface IMyClass { List<IMyClass> GetList();
My code looks like this NSNumber *inputToNumber = [NSNumber numberWithFloat:[textField.text floatValue]]; the value from
My code looks like this : Vector<String> My_Vector=new Vector<String>(); String My_Array[]=new String[100]; for (int
My code looks like this: NSIndexPath *ip = [NSIndexPath indexPathForRow:15 inSection:0]; [[self tableView] selectRowAtIndexPath:ip
My code looks like: Entity e = new Entity(); e.name = ...; e.blah =
At the moment my code looks like this: # Assign values for saving to
My current code looks like the following. How can I pass my array to

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.