debug_backtrace and _drupal_error_handler_real with very high mem usage, can I disable?
_drupal_error_handler_real() is the function called from the error handler installed from Drupal (_drupal_error_handler()). A PHP error handler is called every time there is a not-handled runtime error (not an exception), including a warning.

The code execute from _drupal_error_handler_real() is the following one. debug_backtrace() is always called, if the error level is one set in PHP.

  if ($error_level &amp; error_reporting()) {
    $types = drupal_error_levels();
    list($severity_msg, $severity_level) = $types[$error_level];
    $caller = _drupal_get_last_caller(debug_backtrace());

    if (!function_exists('filter_xss_admin')) {
      require_once DRUPAL_ROOT . '/includes/common.inc';
    }

    // We treat recoverable errors as fatal.
    _drupal_log_error(array(
      '%type' =&gt; isset($types[$error_level]) ? $severity_msg : 'Unknown error',
      // The standard PHP error handler considers that the error messages
      // are HTML. We mimick this behavior here. 
      '!message' =&gt; filter_xss_admin($message), 
      '%function' =&gt; $caller['function'], 
      '%file' =&gt; $caller['file'], 
      '%line' =&gt; $caller['line'], 
      'severity_level' =&gt; $severity_level,
    ), $error_level == E_RECOVERABLE_ERROR);
  }


Also _drupal_log_error() is called when debug_backtrace() is called, but without any module recording the error, the error is not effectively recorded. In fact, the error is recorded if there are modules implementing hook_watchdog(), such as the Database logging module, and the Syslog module. The task of watchdog(), the function called by _drupal_log_error() is pass the information about the error to the implementations of hook_watchdog() which are then free to record the error.

// Prepare the fields to be logged
$log_entry = array(
  'type' =&gt; $type, 
  'message' =&gt; $message, 
  'variables' =&gt; $variables, 
  'severity' =&gt; $severity, 
  'link' =&gt; $link, 
  'user' =&gt; $user, 
  'uid' =&gt; $user_uid, 
  'request_uri' =&gt; $base_root . request_uri(), 
  'referer' =&gt; isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', 
  'ip' =&gt; ip_address(),
  // Request time isn't accurate for long processes, use time() instead. 
  'timestamp' =&gt; time(),
);

// Call the logging hooks to log/process the message
foreach (module_implements('watchdog') as $module) {
  module_invoke($module, 'watchdog', $log_entry);
}