hardware
hardware copied to clipboard
Arithmetic overflow (Overflow error)
trying to get memory percent
require "hardware"
module Caju::Memory
extend self
def get_mem()
mem = Hardware::Memory.new
return mem.used.to_i
end
def get_mem_pct()
mem = Hardware::Memory.new
return mem.percent.to_i
end
end # module
Unhandled exception: Arithmetic overflow (OverflowError)
from lib/hardware/src/memory.cr:64:36 in 'percent'
from src/memory.cr:13:12 in 'get_mem_pct'
from src/caju.cr:29:20 in '__crystal_main'
Hello, any way to reproduce on any host? It will help.
Also, you can modify lib/hardware/src/memory.cr to debug it.