Revision d215d914ee388efb0737135d81dcc581e0016f8e authored by Keno Fischer on 15 July 2023, 17:01:26 UTC, committed by GitHub on 15 July 2023, 17:01:26 UTC
Fixes the case from #50518, but we actually have two test cases in the
tests that also hit this (e.g. this one:
```
f40964(xs::Int...=1; k = 2) = (xs, k)
```
), but just happened not to hit the bad codegen path. #50556, once
merged would have complained on those definitions as well, without this
fix.
2 parent s 191256e + c272236
Raw File
objarray.jl
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Random: seed!
seed!(1)

abstract type Cell end

struct CellA<:Cell
    a::Ref{Int}
end

struct CellB<:Cell
    b::String
end

function fillcells!(mc::Array{Cell})
    for ind in eachindex(mc)
        mc[ind] = ifelse(rand() > 0.5, CellA(ind), CellB(string(ind)))
    end
    return mc
end

function work(size)
    mcells = Array{Cell}(undef, size, size)
    fillcells!(mcells)
end

function run(maxsize)
    Threads.@threads for i in 1:maxsize
        work(i*375)
    end
end

# Memory usage 581 MB
run(4)
GC.gc()
back to top