On Sun, Feb 7, 2016 at 9:54 AM, Yichao Yu <yyc1...@gmail.com> wrote: > On Sun, Feb 7, 2016 at 9:39 AM, Cedric St-Jean <cedric.stj...@gmail.com> > wrote: > > There's an issue on Github to add GC support for stack-allocated objects, > > and that makes no sense to me! Could someone please help me out? In my > mind, > > stack-allocated objects = Int+Float+...+Immutable (in some > circumstances). I > > thought that with Immutables, if I have > > by `Int + Float + ...` I think you mean bitstype. >
Yes. > > > details. Any stack-allocated object gets automatically wiped as the stack > > unwinds, hence does not need GC'ing. > > s/GC/root/ might be a better word. > Agreed. > > > > > Then on the `l` line, because it's an Any array, the ImagePos needs to be > > copied, boxed and heap-allocated. So that one needs GC. > > I'm not really sure what you mean by `needs GC` here. What will happen > is that the element of a `Any` array will be heap(GC) allocated > (boxed) and so is the Array l itself. Therefore, `l` wiill be GC > rooted and elements in the `l` array are reachable by the GC from the > array `l`. > Yes, that's what I meant. Could you please explain what the Github issue is about? > > > > What did I miss? > > > > Cédric >