On Sun, Feb 7, 2016 at 10:11 AM, Bart Janssens <[email protected]> wrote:
> > On Sunday, February 7, 2016 at 3:39:51 PM UTC+1, Cedric St-Jean wrote: > >> then `a` is stack-allocated. The foo(a) call may either copy `a` further, >> or just pass on a stack pointer to the existing `a`, depending on compiler >> details. Any stack-allocated object gets automatically wiped as the stack >> unwinds, hence does not need GC'ing. >> >> > I think that in this case "a" is heap-allocated, since ImagePos is not a > bits type. > I don't think this necessarily follows. Inside ImagePos, there is a pointer to an Image, which is why it's not a bits type, but that doesn't preclude stack allocation in general. > You can check this with isbits(). Just today, I found the following post > that explains this at length: > http://julialang.org/blog/2013/03/efficient-aggregates/ > > Cheers, > > Bart >
