Energy conservation when capacitor charges in a zero resistance circuit We know that when a capacitor charges from a source $E$, it stores energy of $E=\frac{1}{2}QV $.  This is derived without taking into consideration any resistances present in the circuit.
We also know that the battery does work $W=QV$ to pump the charge $Q$. 
It is explained that the remaining $\frac{1}{2}QV$ is dissipated as heat in the circuit resistance. And we can verify it to be true:
$\frac{1}{2}QV= \frac{1}{2}CV^{2} = {\displaystyle \int_0^\infty V_oe^\frac{-t}{RC} \cdot I_oe^\frac{-t}{RC} dt} $
What happens if there the resistance in the circuit is zero? Where will the energy go?
 A: This is not really a reasonable physical situation. The problem is that if the resistance truly is zero then the charge time is also zero and the current is infinite, which is not a reasonable conclusion. In physical cases, something must give: the resistance of the wires, or the internal resistance of the battery, will cease to be negligible before that point.
The proper way to deal with negligible resistances is to work the problem out in full with a nonzero resistance, get a final answer, and then take the limit of $R\to0$. (Note that in many cases this is done backwards in front of students: one starts with negligible resistance and then builds up to the full case. This is justified in the cases where the full case does reduce to the simplified one.) In this particular case, the dissipated energy does not depend on $R$, and this should be read precisely like that:

no matter how small the resistance is, it will always dissipate the same amount of heat.

This is because a smaller resistance gives a shorter charge time and therefore a higher current. In this particular instance, there is no way to connect to the case at $R=0$ - and that case does not make sense anyway.
You probably feel like I'm short-changing you by doing this. What if you made everything out of superconductors? Well, the internal resistance of the battery, which is a must in any chemical source, will get in the way. Indeed, no source of electrical current can provide a finite amount of charge in zero time.
Most basically, though, this is because it takes time for the electrons to get from the source to the capacitor. In the limit where this happens very fast, then you have imbalanced charges travelling and accelerating, and they must stop suddenly at the capacitor plates. As BMS pointed out in a comment, this will inevitably be accompanied by the emission of electromagnetic radiation. The bottom line of this is that there is no way to transiently charge a capacitor without wasting energy.
On the other hand, there is a way to charge a capacitor such that all the energy spent by the battery is stored in the capacitor, and that is by doing it slowly instead of suddenly. That is, you increase the voltage of the battery adiabatically in lots of little steps $\Delta V$, and waiting a time $\tau\gg RC$ between steps so that the voltages will equilibrate. I will leave the precise details to you, but it turns out that in the limit of slow charging (i.e. $\tau/RC\to\infty$) no energy is wasted by the resistor. Finally, it is fairly easy to see that increasing the voltage slowly will mean the energy delivered by the current source will now be $\tfrac12 QV$, as one now traces a triangle instead of a square in the $(Q,V)$ plane.
A: Another way to look at this is to realize that whenever you move charge, you produce a magnetic field. Even a straight wire will have a certain amount of self-inductance.
Initially, this will provide a limit as to how fast the current can increase. As the voltages equalize, the interaction with the magnetic field will actually cause the current to continue increasing, although more slowly, and when the two capacitors are at equal voltage the current will be at its maximum. The collapse of the magnetic field will continue to force charge from the first capacitor to the second, until all charge has been transferred. Then the process will reverse until the first capacitor is fully charged and the second is empty. The exact shape of the current curve will, in fact, be a sine wave. 
When the two capacitors are at equal charge, the missing energy $\frac{1}{2} CV^2$ is contained in the magnetic field, $\frac{1}{2} LI^2$.
All of this ignores the reality of radiated energy, of course, but it serves at this level of description.
