Garbage collection problem?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • petermichaux@yahoo.com

    Garbage collection problem?

    Hi,

    When I run either of the following scripts it runs to completion and
    prints "end" if $limit<=1e4. If $limit>=1e5 then somewhere after many
    loops the script stops and I do not see the final message "end". Is
    there garbage I should be collecting? Am I hitting a type limit? Do php
    scripts have any other limit that I might be hitting?

    I'm confused!

    Thanks,
    Peter

    //////////////////////////////////////////////

    <?php

    $limit = 1e4;

    for ($i=0; $i<$limit; $i++)
    {
    $foo = array();

    for($j=0; $j<100; $j++)
    {
    $foo[] = $j;
    }

    }
    echo 'end';

    ?>

    //////////////////////////////////////////////

    <?php

    $limit = 1e4;

    $foo = array();

    for ($i=0; $i<$limit; $i++)
    {
    for($j=0; $j<100; $j++)
    {
    $foo[$j] = $j;
    }

    }
    echo 'end';

    ?>

  • petermichaux@yahoo.com

    #2
    Re: Garbage collection problem?

    Is the web browser just not willing to wait longer? Same results in
    Firefox and Safari.

    Peter

    Comment

    • Jerry Stuckle

      #3
      Re: Garbage collection problem?

      petermichaux@ya hoo.com wrote:[color=blue]
      > Hi,
      >
      > When I run either of the following scripts it runs to completion and
      > prints "end" if $limit<=1e4. If $limit>=1e5 then somewhere after many
      > loops the script stops and I do not see the final message "end". Is
      > there garbage I should be collecting? Am I hitting a type limit? Do php
      > scripts have any other limit that I might be hitting?
      >
      > I'm confused!
      >
      > Thanks,
      > Peter
      >
      > //////////////////////////////////////////////
      >
      > <?php
      >
      > $limit = 1e4;
      >
      > for ($i=0; $i<$limit; $i++)
      > {
      > $foo = array();
      >
      > for($j=0; $j<100; $j++)
      > {
      > $foo[] = $j;
      > }
      >
      > }
      > echo 'end';
      >
      > ?>
      >
      > //////////////////////////////////////////////
      >
      > <?php
      >
      > $limit = 1e4;
      >
      > $foo = array();
      >
      > for ($i=0; $i<$limit; $i++)
      > {
      > for($j=0; $j<100; $j++)
      > {
      > $foo[$j] = $j;
      > }
      >
      > }
      > echo 'end';
      >
      > ?>
      >[/color]

      Or are you hitting the php timeout limit (default 30 seconds)?


      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • petermichaux@yahoo.com

        #4
        Re: Garbage collection problem?

        Seems like that is it. Thank you!

        Peter

        Comment

        Working...