goldbach-conjecture/memory_info.h
2025-02-01 10:33:57 +00:00

32 lines
918 B
C

//
// Created by Kyle Stevenson on 01/02/2025.
//
#ifndef MEMORY_INFO_H
#define MEMORY_INFO_H
#include <stddef.h> // For size_t
/**
* @brief Fetches the currently available memory (free + inactive/reclaimable memory).
*
* This function is platform-dependent and works on macOS, Linux, and Windows.
* It determines the memory that is not in use and prints the details to the console.
*/
void getAvailableMemory();
/**
* @brief Calculates the number of bits that can be allocated based on available memory.
*
* This function calculates how many bits can be stored in the available memory.
* It uses `getAvailableMemory` to determine the free memory and converts the size
* from bytes to bits.
*
* @param memoryUsageLimit the number 1 - 10 of amount of free memory to use
*
* @return The number of bits that can be allocated.
*/
size_t getAvailableBits(int memoryUsageLimit);
#endif //MEMORY_INFO_H