Skip to content

Commit

Permalink
runtime: add free_memory/0 implementation for OpenBSD (fix #23579) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lcheylus authored Jan 26, 2025
1 parent c225e04 commit 67a8c81
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions vlib/runtime/free_memory_impl_openbsd.c.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module runtime

fn free_memory_impl() usize {
$if cross ? {
return 1
}
$if !cross ? {
$if openbsd {
page_size := usize(C.sysconf(C._SC_PAGESIZE))
av_phys_pages := usize(C.sysconf(C._SC_AVPHYS_PAGES))
return page_size * av_phys_pages
}
}
return 1
}

0 comments on commit 67a8c81

Please sign in to comment.