hello everyone, my demo4.cr is:
require "gzip"
class ReadsMapPositionStat
def initialize()
output_content = "AB" * 1000
output_stat = File.new("./demo4.pos.stat.gz", "w")
fasta = {} of String => Int32
num = 22254436
while num > 0
fasta["OJEBLLGB_00006.#{num}"] = 1000
num -=1
end
l = 60953398
while l > 0
write_to_gzip(output_stat, output_content)
l -=1
end
output_stat.close
puts "end at #{Time.new}"
end
def write_to_gzip(outgzip : IO, content : String)
Gzip::Writer.open(outgzip) do |gzip|
gzip.puts(content)
end
end
end
ReadsMapPositionStat.new()
after build crystal build demo4.cr --release
,then run that code, get error:
mmap(PROT_NONE) failed
$crystal --version
Crystal 0.32.1 [41bd18fbe] (2019-12-18)
LLVM: 8.0.0
Default target: x86_64-unknown-linux-gnu
$cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
but if change to:
require "gzip"
class ReadsMapPositionStat
def initialize()
output_content = "AB" * 1000
output_stat = File.new("./demo4.pos.stat.gz", "w")
fasta = {} of String => Int32
num = 22254436
while num > 0
fasta["OJEBLLGB_00006.#{num}"] = 1000
num -=1
end
Gzip::Writer.open(output_stat) do |gzip|
l = 60953398
while l > 0
gzip.puts(output_content)
l -=1
end
end
output_stat.close
end
end
ReadsMapPositionStat.new()
will get no error~
@straight-shoota thanks for the help~