This leaks memory since `g` was copy (p_Diff does not destroy or reuse the input)!