KDK_RTI_GE...S_FREE_KIB(3)
💖 KDK_RTI_GE...S_FREE_KIB 💖
okay bestie, you found your way into the Library Functions Manual and the page you're on is KDK_RTI_GE...S_FREE_KIB(3) ✨ buckle up, we're doing memory stats 🎀
✨ NAME ✨
kdk_rti_get_mem_res_free_KiB — 获取实际空闲的物理内存大小
iykyk: this one hands you the actually free physical memory number, and lowkey that's the whole vibe 💅
🦋 SYNOPSIS 🦋
#include <libkyrtinfo.h>
extern unsigned long kdk_rti_get_mem_res_free_KiB();
Link with -lkyrtinfo. yes queen, don't forget the link flag or it's giving "undefined reference" 😭
🌸 Detailed Description 🌸
So the main function of this interface is to grab the actual amount of physical memory that is free, and note that Buffer/Cache is counted as used memory. like, it's not playing games with you — Buffer/Cache is NOT free here, it's used, periodt 🫶
💜 RETURN VALUE 💜
- On success, returns the size of free physical memory of type
unsigned long; the unit is KiB ✨ - On error, returns
0💀
🎀 EXAMPLES 🎀
bestie here's a whole lil program, look at her go 🧚
#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;
}
no cap, copy it exactly as written — I'm not touching a single character of it 🙈
🌈 CONFORMING TO 🌈
These functions are as per the withdrawn POSIX.1e draft specification. And 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_available_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 ⭐
the whole friend group, go say hi 👑
kdk_rti_get_mem_res_total_KiB(3)kdk_rti_get_mem_res_usage_percent(3)kdk_rti_get_mem_res_usage_KiB(3)kdk_rti_get_mem_res_available_KiB(3)kdk_rti_get_mem_virt_alloc_KiB(3)kdk_rti_get_mem_swap_total_KiB()kdk_rti_get_mem_swap_usage_percent(3)kdk_rti_get_mem_swap_usage_KiB(3)kdk_rti_get_mem_swap_free_KiB(3)kdk_rti_get_cpu_current_usage(3)kdk_rti_get_uptime(3)
that's the whole page bestie, you ate 💅 this lil masterpiece lives in the Linux Programmer's Manual, dated Mon Sep 18 2023 — go forth and check your free KiB, mwah 🫶✨
📦 where this page comes from
- arch rolling: libkysdk-system 3.0.1.4-1 · LGPL-3.0-or-later AND LGPL-2.1-only OR LGPL-3.0-only AND LGPL-2.1-only WITH Qt-LGPL-exception-1.1 OR LGPL-3.0-only WITH Qt-LGPL-exception-1.1 AND MIT
- ubuntu resolute: libkysdk-system-dev 3.0.1.2-0ubuntu1 · LGPL-3.0-only
- ubuntu stonking: libkysdk-system-dev 3.0.1.3-0ubuntu1 · LGPL-3.0-or-later
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms