|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-11-12 09:41 UTC] twin at nightmail dot ru
[2013-03-02 18:10 UTC] dlsniper@php.net
[2013-03-02 18:10 UTC] dlsniper@php.net
-Status: Open
+Status: Closed
-Type: Bug
+Type: Feature/Change Request
-Assigned To:
+Assigned To: dlsniper
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 09:00:01 2025 UTC |
Description: ------------ Calling debug_backtrace(false) can lead to a huge increase in memory usage, if it's called from within a function that was passed a huge string as an argument. This is because the string will be duplicated in the "args" field of the result. It would be nice to have another boolean argument to debug_backtrace, that would tell it to skip the "args" field. This would be similar to the one that skips the "object" field. Or could the arguments be returned as references, so they don't increase memory usage? Test script: --------------- function test($str) { echo "before: ".round(memory_get_usage()/1024/1024, 2)." MB\n"; debug_backtrace(false); echo "after: ".round(memory_get_usage()/1024/1024, 2)." MB\n"; } test(str_repeat('a', 10000000)); Expected result: ---------------- before: 9.59 MB after: 9.59 MB (This is what I get if I remove the debug_backtrace() call.) Actual result: -------------- before: 9.59 MB after: 19.12 MB