bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory leak in for loops


From: Jan Schampera
Subject: Re: Memory leak in for loops
Date: Thu, 30 Apr 2009 11:56:02 +0200
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Sandino Araico Sánchez wrote:

>    1.
>       #!/bin/bash
>    2.
>        
>    3.
>       for i in {0..150000000} ; do
>    4.
>               echo $i > /dev/null
>    5.
>       done
> 
> 
> 
> Repeat-By:
>         Run the script above and the process starts leaking memory very
> fast.
> 
> 

You know what a memory *leak* is, yes? mallocs() without proper free()s.

What you mean is that your memory is used. Feel free to calculate the
memory that is needed to store the string representation of
{0..150000000}, I think you will get a number near your RAM size.

J.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]