pola-rs/polars · error

invalid value for POLARS_OVERRIDE_TOTAL_MEMORY: {s}

Error message

invalid value for POLARS_OVERRIDE_TOTAL_MEMORY: {s}

What it means

RuntimeError raised by the _CpuId checker's allocation step: the OS call to reserve executable memory (VirtualAlloc on Windows) returned a null pointer, so the CPUID opcode buffer could not be placed and the check cannot run. It indicates memory pressure or OS restrictions on executable allocations.

Source

Thrown at crates/polars-utils/src/sys.rs:22

/// Return the total system memory in bytes.
pub fn total_memory() -> u64 {
    return *TOTAL_MEMORY;

    static TOTAL_MEMORY: LazyLock<u64> = LazyLock::new(|| {
        let mut sys = System::new();

        sys.refresh_memory_specifics(MemoryRefreshKind::nothing().with_ram());

        let mut v: u64 = match sys.cgroup_limits() {
            Some(limits) => limits.total_memory,
            None => sys.total_memory(),
        };

        if let Ok(s) = std::env::var("POLARS_OVERRIDE_TOTAL_MEMORY") {
            v = s
                .parse::<u64>()
                .unwrap_or_else(|_| panic!("invalid value for POLARS_OVERRIDE_TOTAL_MEMORY: {s}"))
        }

        if polars_config::config().verbose() {
            let gib = (v as f64) / (1024.0 * 1024.0 * 1024.0);
            eprintln!("total memory: {gib:.3} GiB ({v} bytes)")
        }

        v
    });
}

/// Startup system is expensive, so we do it once
pub struct MemInfo {
    sys: Mutex<System>,
}

impl MemInfo {
    /// This call is quite expensive, cache the results.

View on GitHub (pinned to 9b5d73fd00)

Solutions

  1. Set POLARS_OVERRIDE_TOTAL_MEMORY to a valid byte size (integer, optionally with suffix) or unset it.

Example fix

export POLARS_OVERRIDE_TOTAL_MEMORY=8589934592
Defensive patterns

Strategy: validation

When it happens

Trigger: POLARS_OVERRIDE_TOTAL_MEMORY holds an unparseable value.

Common situations: See trigger scenarios.


AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19). Data as JSON: /api/errors/915978ea390dfd17. Report an issue: GitHub.