Skip to content

Integer overflow in totalSystemMemory on 32-bit Linux systems #25038

@banshay

Description

@banshay

Zig Version

0.15.1

Steps to Reproduce and Observed Behavior

On a system with 96GB of RAM, run:

  • zig init
  • zig build

Further, when trying to limit memory usage using --maxrss 24G I am very limited as the parsing of this argument returns a usize for a u64. This might be an issue of my system. I ran a little test and usize is a u32.

Architecture:             x86_64
  CPU op-mode(s):         32-bit, 64-bit
  Address sizes:          48 bits physical, 48 bits virtual
  Byte Order:             Little Endian

Expected Behavior

The integer not to overflow or the catch at compiler/build_runner.zig:435 to apply the max u64 as a fallback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.os-linuxLinuxstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions