Skip to content

Commit

Permalink
Only free if the context isn't destroyed.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Mar 19, 2021
1 parent 269a2dd commit 30b661f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/execution.jl
Expand Up @@ -204,7 +204,7 @@ mutable struct HostKernel{F,TT} <: AbstractKernel{F,TT}
kernel = new{F,TT}(ctx, mod, fun, random_state)
finalizer(kernel) do k
if k.random_state isa Mem.DeviceBuffer
Mem.free(k.random_state)
@context! skip_destroyed=true Mem.free(k.random_state)
end
end
return kernel
Expand Down

0 comments on commit 30b661f

Please sign in to comment.