Potential mem-leak issue
For a kerne enabled explicit buffer mamangement, if a field is not referenced in kernel.run
and detected by Aparapi as a KernelArg
, re-assigning a new array onto it and calling kernel.put
would cause mem-leak.
It seems all the array references were stored in KernelRunner.puts
and cannot be release when calling kernel.cleanUpArrays
, because they were not regarded as KernelArg
.
There could be a lot of buffer-field in a kernel, when debugging or tesing things the kernel.run
method could be changed frequently. If a field was temporarily unused (because related codes were commented out or in some other cases), running the kernel would cause mem-leak then.
I do see the notice in documentation,
Note that marking a kernel as explicit and failing to request the appropriate transfer is a programmer error.
for the case above, is there a API to manually mark a field as KernelArg
and make it be releasable? Or we should be more careful to the code changes?