Skip to content

Commit fbdc064

Browse files
committed
Update tests
1 parent 6623f0b commit fbdc064

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/testsuite/alloc_cache.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
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))
@@ -63,11 +63,13 @@
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

0 commit comments

Comments
 (0)