|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-02 21:43 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 15 02:00:01 2025 UTC |
Description: ------------ This script simply augments an array by duplicating its first element a parameter number of time, then displays count of the array and memory usage. $ php finout.php 65536 count:65536/2968016 bytes $ php finout.php 65537 count:65537/3230200 bytes *** glibc detected *** double free or corruption (!prev): 0x0923ce30 *** Aborted When count reaches 65537 glibc issues this "post-mortem" message If instead of $arr[] = $arr[0]; I use $arr[] = 'x'; this message does not come. Reproduce code: --------------- <?php $loop = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1]+0 : 1000; error_reporting(E_ALL); $arr = array ('x') ; while (--$loop) { $arr[] = $arr[0]; } echo 'count:'.count($arr).'/'.memory_get_usage() . " bytes\n"; ?>