-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
UnsafeArrays currently only support types T
for isbitstype(T) == true
.
I suppose the reason for this is that non-bits types are at risk of being GC'ed if their only reference is within an UnsafeArray.
However, this seems overly restrictive as isbitstype
returns false for a lot of types (Unions of bitstypes, Ptrs, ..) that are allocated inline and thus not are in risk of being GC'ed. Instead, Base.allocatedinline
seems like a better alternative.
E.g.
julia> struct Foo
x::Union{Int, Nothing}
end
julia> sizeof(Foo) # 16
16
julia> isbitstype(Foo) # false
false
julia> Base.allocatedinline(Foo) # true
true
julia> isbitstype(Ptr{Int}) # false
true
julia> Base.allocatedinline(Ptr{Int}) # true
true
Metadata
Metadata
Assignees
Labels
No labels