Edit report at http://bugs.php.net/bug.php?id=53237&edit=1
ID: 53237 Updated by: [email protected] Reported by: lifinsky at yandex dot ru Summary: LinkedList max nodes Segmentation fault -Status: Open +Status: Assigned Type: Bug -Package: SPL related +Package: Scripting Engine problem Operating System: Vista, Linux PHP Version: 5.3.3 -Assigned To: +Assigned To: dmitry Block user comment: N New Comment: I noticed crash is caused by following part: $this->_tail->next = $node; $this->_tail = $node; // without this line, no crash Previous Comments: ------------------------------------------------------------------------ [2010-11-03 16:53:26] lifinsky at yandex dot ru Description: ------------ I test linkedList performance and memory usage on Windows Vista Premium with PHP 5.3.3. When list length > 34860 I have server fatal Error ( Segmentation fault) and my fast-cgi script closed. I try test on Linux (PHP 5.2.6) but have some error if length ~ 32735. This error is not related with memory limit. Test script: --------------- class LinkedList { private $_length = 0; private $_head; private $_tail; public function add($data) { $node = (object) array('data' => $data, 'next' => null); if ($this->_length == 0) { $this->_head = $node; $this->_tail = $node; } else { $this->_tail->next = $node; $this->_tail = $node; } $this->_length++; } } $a = new LinkedList(); $startMemory = memory_get_usage(); $start = microtime(true); for ($i = 1; $i <= 34860; $i++) { $a->add($i); } $endMemory = memory_get_usage(); $end = microtime(true); print(($end - $start) . '<br />'); print((int) (($endMemory - $startMemory) / 1024) . '<br />'); Expected result: ---------------- If length = 34860 I got 0.12323784828186 11276 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53237&edit=1
