THe example you have given is an ODE with two dimensions: [tex]
\begin{align*}<br />
x' &= v \\ v' &= - x \end{align*}[/tex] where time is scaled to that [itex]k/m = 1[/itex]. Then the energy is [itex]E = \frac{12}(v^2 + x^2)[/itex].
The result of your numeric integration is a sequence [itex](x_n,v_n)[/itex] which approximates the solution at time [itex](t_n[/itex]. But there will be errors, so [itex]x_{n+1} = x(t_{n+1}) + \epsilon_x(n)[/itex] and similarly for [itex]v[/itex]. Hence [tex]
\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*}[/tex] so assuming [itex](x_n,v_n)[/itex] is exact, at time [itex]t_{n+1}[/itex] you will see that the energy has changed by an amount [tex]\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))[/tex] 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.