We study some properties of a nonconvex variational problem. We fail to attain the infimum of the functional that has to be minimized. Instead, minimizing sequences develop gradient oscillations which allow them to reduce the value of the functional. We show an existence result for a perturbed nonconvex version of the problem, and we study the qualitative properties of the corresponding minimizer. The pattern of the gradient oscillations for the original nonperturbed problem is analyzed numerically.