KDK_RTI_GET_MEM_RES_AVAILABLE_KIB(3)

📦 version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

✨ KDK_RTI_GET_MEM_RES_AVAILABLE_KIB(3) ✨

okay bestie, welcome to the Library Functions Manual 💅 this one's a lil function from the kyrtinfo family and it's literally just here to tell u how much physical memory u actually have to play with 🫶


🌸 NAME 🌸

kdk_rti_get_mem_res_available_KiB — 获取实际可用的物理内存大小

(yes the description is in Chinese and yes we're keeping it exactly as-is, no cap ✨ it means "get the actual available physical memory size")


🎀 SYNOPSIS 🎀

#include <libkyrtinfo.h>

extern unsigned long kdk_rti_get_mem_res_available_KiB();

and don't forget to link it, queen:

Link with -lkyrtinfo.

💖 Detailed Description 💖

so the whole main character job of this interface is to hand u the actual amount of physical memory available — and it's approximately equal to Free + Buffer + Cache. that's it, that's the vibe. 🦋


👑 RETURN VALUE 👑

  • on success — it returns the available physical memory size, typed as unsigned long, and the unit is KiB ✨
  • on error — it returns 0. yes bestie, zero. keep an eye out for that 💀

🌈 EXAMPLES 🌈

here's the whole lil demo, copied exactly, go off:

#include "libkyrtinfo.h"
#include <stdio.h>

int main()
{
    printf("内存总大小:%lu KiB0, kdk_rti_get_mem_res_total_KiB());
    printf("当前已用内存:%lu KiB,%f0, kdk_rti_get_mem_res_usage_KiB(), kdk_rti_get_mem_res_usage_percent());
    printf("当前空闲内存:%lu KiB0, kdk_rti_get_mem_res_free_KiB());
    printf("可用内存大小:%lu KiB0, kdk_rti_get_mem_res_available_KiB());
    printf("应用总申请虚拟内存大小:%lu KiB0, kdk_rti_get_mem_virt_alloc_KiB());
    printf("交换分区总量:%lu KiB0, kdk_rti_get_mem_swap_total_KiB());
    printf("交换分区已用量:%lu KiB, %f0, kdk_rti_get_mem_swap_usage_KiB(), kdk_rti_get_mem_swap_usage_percent());
    printf("交换分区剩余大小:%lu KiB0, kdk_rti_get_mem_swap_free_KiB());
    printf("当前CPU使用率:%f0, kdk_rti_get_cpu_current_usage());
    unsigned int day, hour, min, sec;
    kdk_rti_get_uptime(&day, &hour, &min, &sec);
    printf("开机时长:%u天%u小时%u分钟%u秒0, day, hour, min, sec);
    return 0;
}

🧚 CONFORMING TO 🧚

these functions are as per the withdrawn POSIX.1e draft specification — withdrawn, bestie, so like, vintage energy 💜

the following functions are Linux extensions:

  • kdk_rti_get_mem_res_total_KiB()
  • kdk_rti_get_mem_res_usage_percent()
  • kdk_rti_get_mem_res_usage_KiB()
  • kdk_rti_get_mem_res_free_KiB()
  • kdk_rti_get_mem_virt_alloc_KiB()
  • kdk_rti_get_mem_swap_total_KiB()
  • kdk_rti_get_mem_swap_usage_percent()
  • kdk_rti_get_mem_swap_usage_KiB()
  • kdk_rti_get_mem_swap_free_KiB()
  • kdk_rti_get_cpu_current_usage()
  • kdk_rti_get_uptime()

🦋 SEE ALSO 🦋

go read these next, they're all in the same friend group fr fr:


mwah 💋 that's a wrap on the Linux Programmer's Manual, dated Mon Sep 18 2023, and this whole page lives under the name KDK_RTI_GE...AILABLE_KIB(3) — yes the title is abbreviated with dots and honestly? iconic. stay hydrated, check ur available memory, and slay 💖✨

📦 where this page comes from