Edit report at https://bugs.php.net/bug.php?id=51132&edit=1

 ID:               51132
 Updated by:       php-bugs@lists.php.net
 Reported by:      miha dot space at gmail dot com
 Summary:          LinkedList max nodes, Segmentation fault
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          SPL related
 Operating System: *
 PHP Version:      5.*, 6
 Assigned To:      colder

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2010-04-27 11:22:15] col...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



------------------------------------------------------------------------
[2010-02-24 10:06:42] paj...@php.net

Backtrace: http://pastie.org/840266

------------------------------------------------------------------------
[2010-02-24 09:55:43] miha dot space at gmail dot com

I tried also in Windows Vista and crashes to, if I try with Windows xp sp3 it 
works with $i=1000000 or until the memory_limit is reached.

------------------------------------------------------------------------
[2010-02-24 09:27:57] johan...@php.net

Etienne, please look into it. Thanks.

------------------------------------------------------------------------
[2010-02-24 09:16:21] miha dot space at gmail dot com

Description:
------------
Is there any limit i also tried with memory_get_usage and with 29000 
linkedlistnodes it uses about 9.25MB. In php.ini i have max 128MB, so this 
can't be the problem.

Reproduce code:
---------------
<?php
  class LinkedListNode {
    public $data;
    public $next;

    public function __construct($data) {
      $this->data = $data;
      $this->next = NULL;
    }
  }

  class LinkedList {
    private $first;
    private $last;

    public function __construct() {
      $this->first = NULL;
      $this->last = NULL;
    }

    public function insertLast($data) {
      $node = new LinkedListNode($data);

      if( $this->first != NULL ) {
        $this->last->next = &$node;
        $this->last = &$node;
      }
      else {
        $this->first = &$node;
        $this->last = &$node;
      }
    }
  }

  $list = new LinkedList();

  /* it works
  for($i = 0; $i < 29488; $i++) {
    $list->insertLast(1);
  }*/

  // Segmentation fault
  for($i = 0; $i < 29489; $i++) {
    $list->insertLast(1);
  }
?>

Expected result:
----------------
Nothin, it should exit normally, not segfault.

Actual result:
--------------
 php test2.php
Segmentation fault



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=51132&edit=1

Reply via email to