# File src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb, line 110
    def log_gc_stats_on_request_end
      return do_nothing_on_null(:log_gc_stats_on_request_end) if null?

      # See the docs for MUTEX on why we synchronize this.
      GC_MUTEX.synchronize do
        if OBJECT_SPACE_SUPPORTS_LIVE_OBJECTS
          @transaction.message('Final objects on heap: ' \
            "#{ObjectSpace.live_objects}")
        end
        if OBJECT_SPACE_SUPPORTS_ALLOCATED_OBJECTS
          @transaction.message('Final objects allocated so far: ' \
            "#{ObjectSpace.allocated_objects}")
        elsif OBJECT_SPACE_SUPPORTS_COUNT_OBJECTS
          count = ObjectSpace.count_objects
          @transaction.message('Final objects allocated so far: ' \
            "#{count[:TOTAL] - count[:FREE]}")
        end
        if GC_SUPPORTS_TIME
          @transaction.message("Final GC time: #{GC.time}")
        end
        if GC_SUPPORTS_CLEAR_STATS
          # Clear statistics to void integer wraps.
          GC.clear_stats
        end
      end
    end