跳转至

base/system/memory/private/win_impl/physical_memory.cpp

Physical Memory Query Implementation (Windows) More...

Namespaces

Name
cf
cf::win_impl

Defines

Name
WIN32_LEAN_AND_MEAN

Detailed Description

Physical Memory Query Implementation (Windows)

Author: Charliechen114514 (chengh1922@mails.jlu.edu.cn)

Version: 0.1

Date: 2026-02-23

Copyright: Copyright © 2026

Macros Documentation

define WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN 

Source code

#include "physical_memory.h"
#ifndef WIN32_LEAN_AND_MEAN
#    define WIN32_LEAN_AND_MEAN
#endif
#include <Windows.h>

namespace cf {
namespace win_impl {

void queryPhysicalMemory(PhysicalMemory& physical) {
    MEMORYSTATUSEX status;
    status.dwLength = sizeof(status);
    GlobalMemoryStatusEx(&status);

    physical.total_bytes = status.ullTotalPhys;
    physical.available_bytes = status.ullAvailPhys;
    physical.free_bytes = status.ullAvailPhys; // Windows: AvailPhys ~= Free
}

} // namespace win_impl
} // namespace cf

Updated on 2026-03-09 at 10:14:01 +0000