Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ shards:
git: https://github.com/84codes/lz4.cr.git
version: 1.0.0+git.commit.96d714f7593c66ca7425872fd26c7b1286806d3d

perf_tools:
git: https://github.com/beta-ziliani/perf-tools.git
version: 0.1.0+git.commit.a0f545af92c8347b4339bb3409add5f5f6045a6d

systemd:
git: https://github.com/84codes/systemd.cr.git
version: 2.0.0
Expand Down
3 changes: 3 additions & 0 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ dependencies:
development_dependencies:
ameba:
github: crystal-ameba/ameba
perf_tools:
github: beta-ziliani/perf-tools
branch: feat/refered

crystal: 1.13.0

Expand Down
1 change: 1 addition & 0 deletions src/lavinmq.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require "perf_tools/mem_prof"
require "./lavinmq/version"
require "./stdlib/*"
require "./lavinmq/config"
Expand Down
3 changes: 3 additions & 0 deletions src/lavinmq/launcher.cr
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ module LavinMQ
end

private def run_gc
STDOUT.puts "Log objects linkted to MFile"
STDOUT.flush
PerfTools::MemProf.log_objects_linked_to_type STDOUT, MFile, true
STDOUT.puts "Unmapping all segments"
STDOUT.flush
@amqp_server.vhosts.each_value do |vhost|
Expand Down
2 changes: 2 additions & 0 deletions src/lavinmq/mfile.cr
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ class MFile < IO
end

def finalize
LibC.printf("mfile#finalize %s\n", @path)
PerfTools::MemProf.untrack self.as(Pointer(Void)) # https://github.com/crystal-lang/perf-tools/issues/19
LibC.close(@fd) if @fd > -1
LibC.munmap(@buffer, @capacity) unless @buffer.null?
end
Expand Down