Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutOfMemoryError for Tuple{Vararg{T, N}} where {T} for large N::Int #57813

Open
nsajko opened this issue Mar 18, 2025 · 3 comments
Open

OutOfMemoryError for Tuple{Vararg{T, N}} where {T} for large N::Int #57813

nsajko opened this issue Mar 18, 2025 · 3 comments
Labels
types and dispatch Types, subtyping and method dispatch

Comments

@nsajko
Copy link
Contributor

nsajko commented Mar 18, 2025

I'd expect Julia to be able to handle an UnionAll Vararg like here without trying to expand it. Instead, an OutOfMemoryError is thrown:

julia> struct T{
           N,
           (Tuple{Vararg{T, N}} where {T}) <: Tup <: Tuple,
       }
       end

julia> T{typemax(Int) - 1}
ERROR: OutOfMemoryError()
Stacktrace:
 [1] top-level scope
   @ REPL[2]:1

julia> versioninfo()
Julia Version 1.13.0-DEV.249
Commit bc98abcfbe3 (2025-03-18 05:23 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-19.1.7 (ORCJIT, znver2)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 8 virtual cores)
@nsajko nsajko added the types and dispatch Types, subtyping and method dispatch label Mar 18, 2025
@nsajko
Copy link
Contributor Author

nsajko commented Mar 18, 2025

The same happens for T{typemax(Int) - 1, Tuple}.

@nsajko
Copy link
Contributor Author

nsajko commented Mar 18, 2025

Another example:

julia> struct T{
           N,
           Tup <: NTuple{N},
       }
       end

julia> T{typemax(Int) - 1}
ERROR: OutOfMemoryError()
Stacktrace:
 [1] top-level scope
   @ REPL[2]:1

@vtjnash
Copy link
Member

vtjnash commented Mar 18, 2025

Duplicate of #31681

@vtjnash vtjnash marked this as a duplicate of #31681 Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

2 participants