mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
runtime: add new functions total_memory/0 and free_memory/0 (#18499)
This commit is contained in:
10
vlib/runtime/free_memory_impl_linux.c.v
Normal file
10
vlib/runtime/free_memory_impl_linux.c.v
Normal file
@ -0,0 +1,10 @@
|
||||
module runtime
|
||||
|
||||
fn free_memory_impl() usize {
|
||||
$if linux {
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user