|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-08-28 11:27 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2019-08-28 11:27 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 13:00:01 2025 UTC |
Description: ------------ Using an error handler, throwing and catching the ErrorException leaks memory. Test script: --------------- <?php $last = time(); ini_set('memory_limit', '8G'); set_error_handler(function ($severity, $message, $file, $line) { throw new \ErrorException($message, 0, $severity, $file, $line); }); while(true) { try { trigger_error("Something"); } catch(\Throwable $e) { } if(time() - $last >= 1) { $last = time(); printf("\nMemory: %.4f", memory_get_usage() / (1024 * 1024)); } gc_collect_cycles(); // doesn't help much } Expected result: ---------------- Nearly constant memory usage Actual result: -------------- Memory: 3.7187 Memory: 5.0504 Memory: 6.0593 Memory: 6.9050 Memory: 7.6437 Memory: 8.3095 Memory: 8.9218 Memory: 9.4904 ... Memory: 97.7963 Memory: 219.5202 Memory: 300.1706 Segmentation fault (core dumped)