debug_backtrace() trigger memory allowance issue

604 views Asked by At

I am debugging a Joomla website. For learning purpose, I just want to see which file calls/requests a module's modulename.php file, so I put print_r(debug_backtrace()) in the top line of the modulename.php file, but an error triggered saying:

Allowed memory size of 134217728 bytes exhausted (tried to allocate 98570240 bytes)

I am stuck here. Can someone give me an brief explanation why debug_backtrace() fails in this circumstances?

1

There are 1 answers

0
bkrukowski On

Use flag DEBUG_BACKTRACE_IGNORE_ARGS, e.g. print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));

If you want to display pretty stacktrace with parameters passed to functions, I recommend use my library error-dumper, see an example how it works.