Reputation: 3574
I noticed in this example an annotation that $this->rows[]=$row;
in row 15 would segfault. But I don't understand why. Could someone please explain this to me?
Upvotes: 0
Views: 104
Reputation: 17168
It will either fault, or behave unexpectedly (current versions should not fault).
The reason is that the member $this->rows
is not a thread safe array, its a normal array.
Normal arrays are serialized for storage as a member of the object, so
$this->array[] = $row;
Doesn't make sense; You cannot append onto a serialized array.
In the example, it builds $rows
in the method scope and sets the object member at once with $this->rows = $rows;
.
A thread safe array, which is a Threaded object (they all behave like arrays and come with some sensible manipulation methods such as pop and shift), does not have the same limitation.
Upvotes: 3
Reputation: 74
According to the Blame tool over at Github, We should try paging Joe Watkins (@krakjoe)...
Edit: On my own, an "out of memory" error is the best idea I can come up with. (Googled the line in question, only useful result was about low memory limit)
Upvotes: 0