KDK_RTI_GE..._ALLOC_KIB(3)
✨ KDK_RTI_GE..._ALLOC_KIB(3) ✨
okay so bestie, we're in the Library Functions Manual today and this page is literally about one tiny little function that's out here doing the most important vibe check on your memory 💖 (the man page name up top is KDK_RTI_GE..._ALLOC_KIB(3), fyi, because the real name is too iconic to fit in a header, iykyk)
🌸 NAME 🌸
kdk_rti_get_mem_virt_alloc_KiB — 获取实际空闲的物理内存大小
🎀 SYNOPSIS 🎀
#include <libkyrtinfo.h>
extern unsigned long kdk_rti_get_mem_virt_alloc_KiB();
Link with -lkyrtinfo.
🦋 Detailed Description 🦋
The main function of the interface is to obtain the total amount of virtual memory requested by all apps. that's it. that's the whole job. every app out here asking for memory and this function is keeping receipts 🧾✨
💅 RETURN VALUE 💅
- On success, returns the total virtual memory requests of type
unsigned long; The unit isKiB. (yes bestie, KiB, not KiB-ish, not "kinda bytes", it's KiB fr fr) - On error, return
0.
lowkey if you get a 0 back, that's the error signal, not "nobody wants memory" 😭
🔥 EXAMPLES 🔥
not me showing you the whole group chat of memory functions, here's the example exactly as written:
#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;
}
(the line about 应用总申请虚拟内存大小 is our girl kdk_rti_get_mem_virt_alloc_KiB() showing up in the wild, slay 💖)
🌈 CONFORMING TO 🌈
These functions are as per the withdrawn POSIX.1e draft specification.
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_res_free_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()andkdk_rti_get_uptime()
👑 SEE ALSO 👑
your reading list bestie, go stan all of them:
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_res_free_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)andkdk_rti_get_uptime(3)
and that's the whole page bestie, you ate this 💅✨
this lil beauty is from the Linux Programmer's Manual, dated Mon Sep 18 2023 — love that for us, periodt 🫶
📦 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