|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51132 LinkedList max nodes, Segmentation fault
Submitted: 2010-02-24 09:16 UTC Modified: 2013-02-18 00:34 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: miha dot space at gmail dot com Assigned: colder (profile)
Status: No Feedback Package: SPL related
PHP Version: 5.*, 6 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: miha dot space at gmail dot com
New email:
PHP Version: OS:


 [2010-02-24 09:16 UTC] miha dot space at gmail dot com
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:
  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++) {

  // Segmentation fault
  for($i = 0; $i < 29489; $i++) {

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

Actual result:
 php test2.php
Segmentation fault


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-24 09:27 UTC]
Etienne, please look into it. Thanks.
 [2010-02-24 09:55 UTC] 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 10:06 UTC]
 [2010-03-02 03:02 UTC]
-Package: Scripting Engine problem +Package: SPL related
 [2010-04-27 11:22 UTC]
-Status: Assigned +Status: Feedback
 [2010-04-27 11:22 UTC]
Please try using this snapshot:
For Windows:

 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
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.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Aug 10 05:05:46 2022 UTC