File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 5454 GPUArrays. @cached cache begin
5555 x5 = AT(zeros(T, dims))
5656
57- # we're allowed to early free arrays, which shouldn't release the underlying data
57+ # freeing arrays managed by cache is a no-op until they are released by cache.
5858 GPUArrays. unsafe_free!(x5)
5959 end
6060 _keys = collect(keys(cache. free))
6363 @test length(cache. free[key2]) == 1
6464 @test cache. free[key2][1 ] === GPUArrays. storage(x5)
6565
66- # freeing all memory held by cache should free all allocations
6766 @test ! GPUArrays. storage(x1). freed
68- @test GPUArrays. storage(x5). freed
69- @test GPUArrays. storage(x5). rc. count[] == 1 # the ref appears freed, but the data isn't
67+ @test ! GPUArrays. storage(x5). freed
68+ # the refcount is not impacted by freeing until an array is not managed by cache
69+ @test GPUArrays. storage(x5). rc. count[] == 2
7070 @test ! GPUArrays. storage(x_free). freed
71+
72+ # freeing all memory held by cache should free all allocations
7173 GPUArrays. unsafe_free!(cache)
7274 @test sizeof(cache) == 0
7375 @test GPUArrays. storage(x1). freed
You can’t perform that action at this time.
0 commit comments