# Allocations on field access even though no abstract types are involved

**URL:** <https://discourse.julialang.org/t/allocations-on-field-access-even-though-no-abstract-types-are-involved/126672>\
**Category:** General Usage\
**Created:** [March 7, 2025, 11:06am UTC](https://discourse.julialang.org/t/allocations-on-field-access-even-though-no-abstract-types-are-involved/126672 "2025-03-07T11:06:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![nilsbecker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilsbecker/32/12157_2.png) [@nilsbecker](https://discourse.julialang.org/u/nilsbecker)\
**Post date:** [March 7, 2025, 11:57am UTC](https://discourse.julialang.org/t/allocations-on-field-access-even-though-no-abstract-types-are-involved/126672/4 "2025-03-07T11:57:07Z")

</div>

@Sukera I think it’s the field access, because otherwise `fbare` should also allocate, no?

@BdeKoning To me that reads like it ensures type stability in presence of callable fields. From another [thread](https://discourse.julialang.org/t/function-inside-struct-allocates-when-referenced/105785/4) I picked up the technique to parametrize the struct on the type of the function, `FunctionWithExtra{A}` for example, which gives a concrete type to the struct. This works to avoid alloction with `FunctionBare`, for example. Also,

```julia
julia> typeof(fwe)
FunctionWithExtra{var"#112#113"}

```

appears to have a concrete type. Am I mistaken?

---

_[View the full topic](https://discourse.julialang.org/t/allocations-on-field-access-even-though-no-abstract-types-are-involved/126672)._
