hardware icon indicating copy to clipboard operation
hardware copied to clipboard

Arithmetic overflow (Overflow error)

Open perfecto25 opened this issue 1 year ago • 1 comments

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'

perfecto25 avatar Nov 22 '24 03:11 perfecto25

Hello, any way to reproduce on any host? It will help. Also, you can modify lib/hardware/src/memory.cr to debug it.

j8r avatar Jan 19 '25 14:01 j8r