Description of the problem
With multiple variables, when the gradient is overwritten for the next variable the previous gradient pointer should be cleared from heap memory. Currently, it leads to a memory leak.
Example of the problem
References/Other comments