What is being told in here, is that:
foreach my $m (1..1e7 ) {
my @array;
foreach my $n (1..1e7 ) {
push @array, $n;
}
print "in\n";
}
print "sleeping\n";
sleep 600;
Stops growing in memory.
In normal execution, when the memory is no longer used, the OS will cache it.
Bes
On 11-05-19 01:39 AM, Sheppy R wrote:
how would you change the original code to get it to free up memory?
Put the processing in a sub-process. When it dies, the memory is
returned to the system.
See:
perldoc -f fork
perldoc perlipc
--
Just my 0.0002 million dollars worth,
Shawn
Con
> "JG" == Jim Green writes:
JG> I have a quick question about memory release in perl:
JG> {
JG> my @array;
JG> foreach my $n (1..1e7 ) {
JG> push @array, $n;
JG> print "$n\n";
JG> }
JG> }
someone asked about the original code. this is a silly exa
> "SR" == Sheppy R writes:
SR> Uri, how would you change the original code to get it to free up
SR> memory? I've run into this issue myself quite a few times. I've
SR> also seen perl consume an entire cpu core without even trying.
SR> Could you rework the original scriptlet to show
Uri, how would you change the original code to get it to free up memory?
I've run into this issue myself quite a few times. I've also seen perl
consume an entire cpu core without even trying. Could you rework the
original scriptlet to show how you would free the memory at the end or
direct us to
> "JG" == Jim Green writes:
JG> On 18 May 2011 20:39, Shawn H Corey wrote:
>> On 11-05-18 08:36 PM, Jim Green wrote:
>>>
>>> is this the same for other language like c++ or java?
>>
>> For all processes. That's why deamons periodically respawn; to clean up
>> messes like thi
> "SHC" == Shawn H Corey writes:
SHC> On 11-05-18 08:36 PM, Jim Green wrote:
>> is this the same for other language like c++ or java?
SHC> For all processes. That's why deamons periodically respawn; to clean
SHC> up messes like this.
again, somewhat incorrect. a properly well writt
> "SHC" == Shawn H Corey writes:
SHC> On 11-05-18 08:25 PM, Jim Gibson wrote:
>> Perl hangs on to the memory and does not return it back to the operating
>> system.
SHC> Under UNIX, et al. all processes hang on to their memory because it's
SHC> too time consuming to give it back.
On 18 May 2011 20:39, Shawn H Corey wrote:
> On 11-05-18 08:36 PM, Jim Green wrote:
>>
>> is this the same for other language like c++ or java?
>
> For all processes. That's why deamons periodically respawn; to clean up
> messes like this.
Thank you! I just wish this is not a deficiency in Perl
On 11-05-18 08:36 PM, Jim Green wrote:
is this the same for other language like c++ or java?
For all processes. That's why deamons periodically respawn; to clean up
messes like this.
--
Just my 0.0002 million dollars worth,
Shawn
Confusion is the first step of understanding.
Progra
On 18 May 2011 20:30, Paul Johnson wrote:
> On Wed, May 18, 2011 at 05:16:23PM -0700, Jim Green wrote:
>> Hello List!
>> I have a quick question about memory release in perl:
>>
>> {
>> my @array;
>>
>> foreach my $n (1..1e7 ) {
>> push @array, $n;
>> print "$n\n";
>> }
On Wed, May 18, 2011 at 05:16:23PM -0700, Jim Green wrote:
> Hello List!
> I have a quick question about memory release in perl:
>
> {
> my @array;
>
> foreach my $n (1..1e7 ) {
> push @array, $n;
> print "$n\n";
> }
> }
>
> print "sleeping\n";
> sleep 600;
>
> after
On 11-05-18 08:25 PM, Jim Gibson wrote:
Perl hangs on to the memory and does not return it back to the operating
system.
Under UNIX, et al. all processes hang on to their memory because it's
too time consuming to give it back.
--
Just my 0.0002 million dollars worth,
Shawn
Confusion
On 5/18/11 Wed May 18, 2011 5:16 PM, "Jim Green"
scribbled:
> Hello List!
> I have a quick question about memory release in perl:
>
> {
> my @array;
>
> foreach my $n (1..1e7 ) {
> push @array, $n;
> print "$n\n";
> }
> }
>
> print "sleeping\n";
> sleep 600;
>
>
Hello List!
I have a quick question about memory release in perl:
{
my @array;
foreach my $n (1..1e7 ) {
push @array, $n;
print "$n\n";
}
}
print "sleeping\n";
sleep 600;
after the code block, I epxect memory usage to drop to almost zero
because @array went out of sc
15 matches
Mail list logo