Ok, good to know. Thanks!

Gord

On Tuesday, November 24, 2015 at 9:38:18 PM UTC-5, Tim Holy wrote:
>
> On Tuesday, November 24, 2015 04:53:11 PM Gord Stephen wrote: 
> > The problem arises when I need to repeat the process more than once - 
> when 
> > the SubArrays become out of scope they're garbage collected but A isn't 
> - a 
> > second call to demo2() then exceeds available memory. 
>
> That sounds like a bug. Indeed, I can (sort of) reproduce this: 
>
> julia> function foo() 
>            A = rand(3,5) 
>            B = sub(A, 1:2, 3:4) 
>            finalizer(A, A->@schedule(println("GCed A"))) 
>            B 
>        end 
> foo (generic function with 1 method) 
>
> julia> B = foo() 
> 2x2 
> SubArray{Float64,2,Array{Float64,2},Tuple{UnitRange{Int64},UnitRange{Int64}},1}:
>  
>
>  0.583567  0.719624 
>  0.60663   0.739911 
>
> julia> B = 0 
> 0 
>
> julia> gc() 
>
>
> But call gc() immediately again, and it gets cleaned up: 
>
> julia> gc() 
> GCed A 
>
> I filed an issue: 
> https://github.com/JuliaLang/julia/issues/14127 
>
> --Tim 
>
>

Reply via email to