Re: memory usage/release & GC

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

 



On Dec 31, 2010 6:20 AM, "Tommy Pham" <tommyhp2@xxxxxxxxx> wrote:
>
> Hi folks,
>
> With the recent thread about password & security, I wrote a small quick
> script to generate a random or all possible passwords based on certain
> parameters for a brute force use.  On a very long running execution for a
> complex password in length with full use of the keys (94 characters),
> including upper case, the script seems to consumes more memory (shown in
> Windows task manager) as time progress.  Below are snippets from the
script
> file that does the workload:
>
> while (!$this->isMax())
> {
>        for ($b = 0; $b <= $this->pwdLength; $b++)
>        {
>                if ($this->counter[$b] < $this->max)
>                {
>                        $this->pwd[$b] =
> $this->charList[$this->counter[$b]];
>                        $this->counter[$b]++;
>                        break;
>                }
>                else
>                {
>                        $this->counter[$b] = 1;
>                        $this->pwd[$b] = $this->charList[0];
>                }
>        }
> }
>
> private function isMax()
> {
>        for ($a = $this->pwdLength-1; $a>=0; $a--)
>        {
>                if ($this->counter[$a] < $this->max) return false;
>        }
>        return true;
> }
>
> Could someone please tell me why the above code consumes additional memory
> as time progress for the execution of the while loop?  Researching PHP GC
on
> google didn't shed light on problem.  Generating all possible combinations
> for 20 length with 94 possibilities each, the script easily consumes more
> than 1GB RAM in few minutes.  BTW, gc_enabled() reports on.
>
> Thanks,
> Tommy
>
>

Are you storing or throwing away the passwords? Also, lots of code is
missing from that post, no idea if you've got a memory leak in the rest of
the code

Regards
Peter

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux