Skip to content

test_stringdtype::test_large_string_memory_limit failing memory usage check in CI job #33369

Closed

Description

@rgommers

This test may have limits that are a bit too tight, observed in this log on macOS:

    FAILED _core/tests/test_stringdtype.py::test_large_string_memory_limit - Failed: `/private/var/folders/2s/vty41l455yv698g4xkgfv7z00000gn/T/cibw-run-dsqj_of2/cp314t-macosx_arm64/venv-test-arm64/bin/python -c from numpy.testing._private.utils import _run_with_memory_limit; _run_with_memory_limit(*[('_operator', None, 'call'), ('test_stringdtype', '/private/var/folders/2s/vty41l455yv698g4xkgfv7z00000gn/T/cibw-run-dsqj_of2/cp314t-macosx_arm64/venv-test-arm64/lib/python3.14t/site-packages/numpy/_core/tests/test_stringdtype.py', '_large_string_args')], 6291456)` failed (exit 1)
    ----- stdout -----
    
    ----- stderr -----
    Memory-limit check 'multiply' failed while running the check.
    Requested limits: soft=421782487040, hard=9223372036854775807 bytes; measured address space=421776195584 bytes; additional allowance=6291456 bytes.
    Traceback (most recent call last):
      File "/private/var/folders/2s/vty41l455yv698g4xkgfv7z00000gn/T/cibw-run-dsqj_of2/cp314t-macosx_arm64/venv-test-arm64/lib/python3.14t/site-packages/numpy/testing/_private/utils.py", line 3010, in _run_with_memory_limit
        func(*args)
        ~~~~^^^^^^^
      File "/private/var/folders/2s/vty41l455yv698g4xkgfv7z00000gn/T/cibw-run-dsqj_of2/cp314t-macosx_arm64/venv-test-arm64/lib/python3.14t/site-packages/numpy/_core/strings.py", line 199, in multiply
        return a * i
               ~~^~~
    MemoryError: Failed to allocate string in multiply
    Memory-limit check 'replace' failed while running the check.
    Requested limits: soft=421782618112, hard=9223372036854775807 bytes; measured address space=421776326656 bytes; additional allowance=6291456 bytes.
    Traceback (most recent call last):
      File "/private/var/folders/2s/vty41l455yv698g4xkgfv7z00000gn/T/cibw-run-dsqj_of2/cp314t-macosx_arm64/venv-test-arm64/lib/python3.14t/site-packages/numpy/testing/_private/utils.py", line 3010, in _run_with_memory_limit
        func(*args)
        ~~~~^^^^^^^
      File "/private/var/folders/2s/vty41l455yv698g4xkgfv7z00000gn/T/cibw-run-dsqj_of2/cp314t-macosx_arm64/venv-test-arm64/lib/python3.14t/site-packages/numpy/_core/strings.py", line 1343, in replace
        return _replace(a, old, new, count)
    MemoryError: Failed to allocate string in replace
    Memory-limit check 'rjust' failed while running the check.
    Requested limits: soft=421782667264, hard=9223372036854775807 bytes; measured address space=421776375808 bytes; additional allowance=6291456 bytes.
    Traceback (most recent call last):
      File "/private/var/folders/2s/vty41l455yv698g4xkgfv7z00000gn/T/cibw-run-dsqj_of2/cp314t-macosx_arm64/venv-test-arm64/lib/python3.14t/site-packages/numpy/testing/_private/utils.py", line 3010, in _run_with_memory_limit
        func(*args)
        ~~~~^^^^^^^
      File "/private/var/folders/2s/vty41l455yv698g4xkgfv7z00000gn/T/cibw-run-dsqj_of2/cp314t-macosx_arm64/venv-test-arm64/lib/python3.14t/site-packages/numpy/_core/strings.py", line 879, in rjust
        return _rjust(a, width, fillchar)
    MemoryError: Failed to allocate string in _rjust
    Memory-limit checks failed (see child diagnostics above):
      multiply: exited with status 1
      replace: exited with status 1
      rjust: exited with status 1
    1 failed, 52729 passed, 601 skipped, 62 xfailed, 2 xpassed, 13 warnings in 498.06s (0:08:18)

Cc @ngoldbaum

Activity

  1. rgommers commented on Nov 18, 2026

    @rgommers
    MemberAuthor

    And not a flake, the re-run failed with:

        Memory-limit check 'replace' failed while running the check.
        Requested limits: soft=421648400384, hard=9223372036854775807 bytes; measured address space=421642108928 bytes; additional allowance=6291456 bytes.
    
  2. ngoldbaum commented on Nov 18, 2026

    @ngoldbaum
    Member

    Thanks for the ping, I'll take a look at this today.

  3. ngoldbaum commented on Nov 18, 2026

    @ngoldbaum
    Member

    The linked test run was the first scheduled wheel builder run with the new memory limit test. The wheel builders include an arm64 macos-15 build, which apparently CI doesn't cover. The legacy allocator used by default on older MacOS releases use a 128 MiB region size. The test is based on virtual memory headroom, so the system allocator's 128 MiB allocation triggers the 6 MiB limit in the test.

    I'm not able to reproduce this behavior with the new default allocator used on aarch64 starting in Tahoe (MacOS 26). So I think the most straightforward fix is to gate this test on the architecture and MacOS version introspected from the stdlib platform API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions