use OCP\Server;
use OCP\Share;
use OCP\User\Events\UserChangedEvent;
+use OCP\Util;
use Psr\Log\LoggerInterface;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use function OCP\Log\logger;
register_shutdown_function(function () use ($eventLogger) {
$eventLogger->end('request');
});
+
+ register_shutdown_function(function () {
+ $memoryPeak = memory_get_peak_usage();
+ if ($memoryPeak > 300_000_000) {
+ $message = 'Request used more than 300 MB of ram: ' . Util::humanFileSize($memoryPeak);
+ $logger = \OCP\Server::get(LoggerInterface::class);
+ $logger->warning($message, ['app' => 'core']);
+ }
+ });
}
/**