diff --git a/app/Config/Toolbar.php b/app/Config/Toolbar.php index 16a37e83c2b8..7183e1336a28 100644 --- a/app/Config/Toolbar.php +++ b/app/Config/Toolbar.php @@ -44,6 +44,18 @@ class Toolbar extends BaseConfig Events::class, ]; + /** + * -------------------------------------------------------------------------- + * Collect Var Data + * -------------------------------------------------------------------------- + * + * If set to false var data from the views will not be colleted. Usefull to + * avoid high memory usage when there are lots of data passed to the view. + * + * @var bool + */ + public $collectVarData = true; + /** * -------------------------------------------------------------------------- * Max History diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php index b951e2ed9658..3502ae877caf 100644 --- a/system/Debug/Toolbar.php +++ b/system/Debug/Toolbar.php @@ -310,6 +310,10 @@ protected function structureTimelineData(array $elements): array */ protected function collectVarData(): array { + if (! ($this->config->collectVarData ?? true)) { + return []; + } + $data = []; foreach ($this->collectors as $collector) {