% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RcppExports.R
\name{get_available_ram}
\alias{get_available_ram}
\title{Get available (free) system RAM}
\usage{
get_available_ram()
}
\value{
Numeric value with available RAM in gigabytes (GB)
}
\description{
Returns the amount of RAM currently available for allocation.
}
\details{
This function returns the RAM that can be allocated without swapping.
The value changes dynamically as processes allocate and free memory.

\strong{Important notes:}
\itemize{
\item Value can change rapidly; don't cache it
\item On Linux, uses MemAvailable (more accurate than MemFree)
\item Includes memory that can be reclaimed from caches
\item Actual allocatable memory may be slightly less
}

\strong{Use case:}
Check available RAM before loading large datasets into memory.
}
\examples{
\donttest{
available <- get_available_ram()
cat("Available RAM:", round(available, 2), "GB\n")

# Use it to decide how much data to load
fn <- tempfile(fileext = ".h5")
X  <- hdf5_create_matrix(fn, "data/M",
                          data = matrix(rnorm(1000), 100, 10))

size_gb <- prod(dim(X)) * 8 / 1e9
if (get_available_ram() > size_gb * 1.2) {
  mat <- as.matrix(X)
} else {
  mat <- X[1:50, ]
}

hdf5_close_all()
unlink(fn)
}

}
\seealso{
\code{\link{get_total_ram}}, \code{\link{can_allocate}}
}
