xtd 1.0.0
Loading...
Searching...
No Matches
xtd::memory_information Class Reference
Inheritance diagram for xtd::memory_information:
xtd::static_object

Definition

Represents information about the memory. This class is static.

Namespace
xtd
Library
xtd.core
Examples
The following example shows how to retrieve some information about the memory.
#include <xtd/xtd>
auto main() -> int {
console::write_line("Physical memory");
console::write_line("Virtual memory");
console::write_line("Process memory");
}
// This code can produce the following output :
//
// Physical memory
// total = 34359738368 ( 32 GB)
// used = 18914050048 ( 17 GB)
// free = 15445688320 ( 14 GB)
//
// Virtual memory
// total = 600992124928 (559 GB)
// used = 420945264640 (392 GB)
// free = 180046860288 (167 GB)
//
// Process memory
// total = 180046860288 (167 GB)
// used = 40550400 ( 38 MB)
// free = 180006309888 (167 GB)
static auto write_line() -> void
Writes the current line terminator to the standard output stream using the specified format informati...
static auto get_used_virtual_memory() noexcept -> xtd::usize
Gets the used virtual memory in bytes.
static auto get_free_virtual_memory() noexcept -> xtd::usize
Gets the free virtual memory in bytes.
static auto get_total_physical_memory() noexcept -> xtd::usize
Gets the total physical memory in bytes.
static auto get_free_process_memory() noexcept -> xtd::usize
Gets the free process memory in bytes.
static auto get_free_physical_memory() noexcept -> xtd::usize
Gets the free physical memory in bytes.
static auto get_total_virtual_memory() noexcept -> xtd::usize
Gets the total virtual memory in bytes.
static auto get_total_process_memory() noexcept -> xtd::usize
Gets the total physical memory in bytes.
static auto get_used_process_memory() noexcept -> xtd::usize
Gets the used physical memory in bytes.
static auto get_used_physical_memory() noexcept -> xtd::usize
Gets the used physical memory information in bytes.

Public Static Methods

static auto get_free_physical_memory () noexcept -> xtd::usize
 Gets the free physical memory in bytes.
static auto get_free_process_memory () noexcept -> xtd::usize
 Gets the free process memory in bytes.
static auto get_free_virtual_memory () noexcept -> xtd::usize
 Gets the free virtual memory in bytes.
static auto get_total_physical_memory () noexcept -> xtd::usize
 Gets the total physical memory in bytes.
static auto get_total_process_memory () noexcept -> xtd::usize
 Gets the total physical memory in bytes.
static auto get_total_virtual_memory () noexcept -> xtd::usize
 Gets the total virtual memory in bytes.
static auto get_used_physical_memory () noexcept -> xtd::usize
 Gets the used physical memory information in bytes.
static auto get_used_process_memory () noexcept -> xtd::usize
 Gets the used physical memory in bytes.
static auto get_used_virtual_memory () noexcept -> xtd::usize
 Gets the used virtual memory in bytes.

Member Function Documentation

◆ get_free_physical_memory()

auto xtd::memory_information::get_free_physical_memory ( ) -> xtd::usize
staticnodiscardnoexcept

Gets the free physical memory in bytes.

Returns
The free physical memory value.
Examples
The following example shows how to retrieve some information about the memory.
#include <xtd/xtd>
auto main() -> int {
console::write_line("Physical memory");
console::write_line("Virtual memory");
console::write_line("Process memory");
}
// This code can produce the following output :
//
// Physical memory
// total = 34359738368 ( 32 GB)
// used = 18914050048 ( 17 GB)
// free = 15445688320 ( 14 GB)
//
// Virtual memory
// total = 600992124928 (559 GB)
// used = 420945264640 (392 GB)
// free = 180046860288 (167 GB)
//
// Process memory
// total = 180046860288 (167 GB)
// used = 40550400 ( 38 MB)
// free = 180006309888 (167 GB)
Remarks
The free physical memory is equal to xtd::memory_information::get_total_physical_memory minus xtd::memory_information::get_used_physical_memory.

◆ get_free_process_memory()

auto xtd::memory_information::get_free_process_memory ( ) -> xtd::usize
staticnodiscardnoexcept

Gets the free process memory in bytes.

Returns
The free process memory value.
Examples
The following example shows how to retrieve some information about the memory.
#include <xtd/xtd>
auto main() -> int {
console::write_line("Physical memory");
console::write_line("Virtual memory");
console::write_line("Process memory");
}
// This code can produce the following output :
//
// Physical memory
// total = 34359738368 ( 32 GB)
// used = 18914050048 ( 17 GB)
// free = 15445688320 ( 14 GB)
//
// Virtual memory
// total = 600992124928 (559 GB)
// used = 420945264640 (392 GB)
// free = 180046860288 (167 GB)
//
// Process memory
// total = 180046860288 (167 GB)
// used = 40550400 ( 38 MB)
// free = 180006309888 (167 GB)
Remarks
The free process memory is equal to xtd::memory_information::get_total_process_memory minus xtd::memory_information::get_used_process_memory.

◆ get_free_virtual_memory()

auto xtd::memory_information::get_free_virtual_memory ( ) -> xtd::usize
staticnodiscardnoexcept

Gets the free virtual memory in bytes.

Returns
The free virtual memory value.
Examples
The following example shows how to retrieve some information about the memory.
#include <xtd/xtd>
auto main() -> int {
console::write_line("Physical memory");
console::write_line("Virtual memory");
console::write_line("Process memory");
}
// This code can produce the following output :
//
// Physical memory
// total = 34359738368 ( 32 GB)
// used = 18914050048 ( 17 GB)
// free = 15445688320 ( 14 GB)
//
// Virtual memory
// total = 600992124928 (559 GB)
// used = 420945264640 (392 GB)
// free = 180046860288 (167 GB)
//
// Process memory
// total = 180046860288 (167 GB)
// used = 40550400 ( 38 MB)
// free = 180006309888 (167 GB)
Remarks
The free virtual memory is equal to xtd::memory_information::get_total_virtual_memory minus xtd::memory_information::get_used_virtual_memory.

◆ get_total_physical_memory()

auto xtd::memory_information::get_total_physical_memory ( ) -> xtd::usize
staticnodiscardnoexcept

Gets the total physical memory in bytes.

Returns
The total physical memory value.
Examples
The following example shows how to retrieve some information about the memory.
#include <xtd/xtd>
auto main() -> int {
console::write_line("Physical memory");
console::write_line("Virtual memory");
console::write_line("Process memory");
}
// This code can produce the following output :
//
// Physical memory
// total = 34359738368 ( 32 GB)
// used = 18914050048 ( 17 GB)
// free = 15445688320 ( 14 GB)
//
// Virtual memory
// total = 600992124928 (559 GB)
// used = 420945264640 (392 GB)
// free = 180046860288 (167 GB)
//
// Process memory
// total = 180046860288 (167 GB)
// used = 40550400 ( 38 MB)
// free = 180006309888 (167 GB)
Remarks
The total physical memory corresponds to the amount of RAM on the computer or the amount of RAM allocated to the virtual machine in the case of virtualisation.

◆ get_total_process_memory()

auto xtd::memory_information::get_total_process_memory ( ) -> xtd::usize
staticnodiscardnoexcept

Gets the total physical memory in bytes.

Returns
The total process memory value.
Examples
The following example shows how to retrieve some information about the memory.
#include <xtd/xtd>
auto main() -> int {
console::write_line("Physical memory");
console::write_line("Virtual memory");
console::write_line("Process memory");
}
// This code can produce the following output :
//
// Physical memory
// total = 34359738368 ( 32 GB)
// used = 18914050048 ( 17 GB)
// free = 15445688320 ( 14 GB)
//
// Virtual memory
// total = 600992124928 (559 GB)
// used = 420945264640 (392 GB)
// free = 180046860288 (167 GB)
//
// Process memory
// total = 180046860288 (167 GB)
// used = 40550400 ( 38 MB)
// free = 180006309888 (167 GB)
Remarks
There is no strict predefined limit on the amount of memory an individual process can use
Some OS allow you to set resource usage limits for processes using the ulimit command. For example, a user or system administrator can set a memory limit for a particular process.
If the user has specified a limit, then the total memory will be equal to this limit; otherwise it will be equal to xtd::memory_information::get_free_virtual_memory.

◆ get_total_virtual_memory()

auto xtd::memory_information::get_total_virtual_memory ( ) -> xtd::usize
staticnodiscardnoexcept

Gets the total virtual memory in bytes.

Returns
The total virtual memory value.
Examples
The following example shows how to retrieve some information about the memory.
#include <xtd/xtd>
auto main() -> int {
console::write_line("Physical memory");
console::write_line("Virtual memory");
console::write_line("Process memory");
}
// This code can produce the following output :
//
// Physical memory
// total = 34359738368 ( 32 GB)
// used = 18914050048 ( 17 GB)
// free = 15445688320 ( 14 GB)
//
// Virtual memory
// total = 600992124928 (559 GB)
// used = 420945264640 (392 GB)
// free = 180046860288 (167 GB)
//
// Process memory
// total = 180046860288 (167 GB)
// used = 40550400 ( 38 MB)
// free = 180006309888 (167 GB)
Remarks
Each OS has its own way of managing and allocating virtual memory.
It is possible that the OS has no virtual memory, in which case the method will return 0.

◆ get_used_physical_memory()

auto xtd::memory_information::get_used_physical_memory ( ) -> xtd::usize
staticnodiscardnoexcept

Gets the used physical memory information in bytes.

Returns
The used physical memory value.
Examples
The following example shows how to retrieve some information about the memory.
#include <xtd/xtd>
auto main() -> int {
console::write_line("Physical memory");
console::write_line("Virtual memory");
console::write_line("Process memory");
}
// This code can produce the following output :
//
// Physical memory
// total = 34359738368 ( 32 GB)
// used = 18914050048 ( 17 GB)
// free = 15445688320 ( 14 GB)
//
// Virtual memory
// total = 600992124928 (559 GB)
// used = 420945264640 (392 GB)
// free = 180046860288 (167 GB)
//
// Process memory
// total = 180046860288 (167 GB)
// used = 40550400 ( 38 MB)
// free = 180006309888 (167 GB)

◆ get_used_process_memory()

auto xtd::memory_information::get_used_process_memory ( ) -> xtd::usize
staticnodiscardnoexcept

Gets the used physical memory in bytes.

Returns
The used process memory value.
Examples
The following example shows how to retrieve some information about the memory.
#include <xtd/xtd>
auto main() -> int {
console::write_line("Physical memory");
console::write_line("Virtual memory");
console::write_line("Process memory");
}
// This code can produce the following output :
//
// Physical memory
// total = 34359738368 ( 32 GB)
// used = 18914050048 ( 17 GB)
// free = 15445688320 ( 14 GB)
//
// Virtual memory
// total = 600992124928 (559 GB)
// used = 420945264640 (392 GB)
// free = 180046860288 (167 GB)
//
// Process memory
// total = 180046860288 (167 GB)
// used = 40550400 ( 38 MB)
// free = 180006309888 (167 GB)

◆ get_used_virtual_memory()

auto xtd::memory_information::get_used_virtual_memory ( ) -> xtd::usize
staticnodiscardnoexcept

Gets the used virtual memory in bytes.

Returns
The used virtual memory value.
Examples
The following example shows how to retrieve some information about the memory.
#include <xtd/xtd>
auto main() -> int {
console::write_line("Physical memory");
console::write_line("Virtual memory");
console::write_line("Process memory");
}
// This code can produce the following output :
//
// Physical memory
// total = 34359738368 ( 32 GB)
// used = 18914050048 ( 17 GB)
// free = 15445688320 ( 14 GB)
//
// Virtual memory
// total = 600992124928 (559 GB)
// used = 420945264640 (392 GB)
// free = 180046860288 (167 GB)
//
// Process memory
// total = 180046860288 (167 GB)
// used = 40550400 ( 38 MB)
// free = 180006309888 (167 GB)

The documentation for this class was generated from the following file: