mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 10:54:22 +08:00
22 lines
458 B
Ruby
22 lines
458 B
Ruby
class Admin::DiagnosticsController < Admin::AdminController
|
|
layout false
|
|
skip_before_filter :check_xhr
|
|
|
|
def memory_stats
|
|
|
|
begin
|
|
# ruby 2.1
|
|
GC.start(full_mark: true)
|
|
rescue
|
|
GC.start
|
|
end
|
|
|
|
stats = GC.stat.map{|k,v| "#{k}: #{v}"}
|
|
counts = ObjectSpace.count_objects.map{|k,v| "#{k}: #{v}"}
|
|
|
|
render text: "GC STATS:\n#{stats.join("\n")} \n\nObjects:\n#{counts.join("\n")}",
|
|
content_type: Mime::TEXT
|
|
|
|
end
|
|
end
|