THe example you have given is an ODE with two dimensions: <br />
\begin{align*}<br />
x' &= v \\ v' &= - x \end{align*} where time is scaled to that k/m = 1. Then the energy is E = \frac{12}(v^2 + x^2).
The result of your numeric integration is a sequence (x_n,v_n) which approximates the solution at time (t_n. But there will be errors, so x_{n+1} = x(t_{n+1}) + \epsilon_x(n) and similarly for v. Hence <br />
\begin{align*}<br />
E_{n} &= \frac12 \left( (v(t_n) + \epsilon_v)^2 + (x(t_n) + \epsilon_x)^2 \right) \\<br />
&= E(t_n) + v(t_n) \epsilon_v + x(t_n)\epsilon_x + \frac12 (\epsilon_v^2 + \epsilon_x^2).<br />
\end{align*}<br /> so assuming (x_n,v_n) is exact, at time t_{n+1} you will see that the energy has changed by an amount \Delta E = v(t_{n+1}) \epsilon_v(n+1) + x(t_{n+1})\epsilon_x(n+1) + \frac12 (\epsilon_v^2(n+1) + \epsilon_x^2(n+1))<br /> which in general is not zero.
So for a PDE the answer must be that whether or not energy is conserved depends on both the time integration and the spatial discretization.