Understanding conservation of energy in a pulley problem I am trying to check if my understanding of conservation of energy is correct. Imagine a pulley problem like so with $m_2$ heavier than $m_1$ and the pulley is ideal (in the original problem I borrowed this from $v$, $m_1$, and $m_2$ are given:

and our goal is to find $h$.
Splitting the energy up we have at rest, all energy must balance so:
$E_i = KE + PE = m_2gh$
Taking the ground as the zero potential plane. Since $m_1$ is at rest at the $0$ potential plane there's no energy there. Since nothing is moving, there is also no kinetic energy.
Now, looking at the energy situation in the final period when we release the system and $m_2$ hits the ground:
$E_f = KE + PE = \frac{m_2v^2}{2} + \frac{m_1v^2}{2} + m_1gh$.
Of course, setting these equal (since energy is conserved) and solving for $h$ gives the answer.
I want to reason out why the kinetic energy is the way it is in the final configuration. Initially I had thought that since the system is once again at rest, the only kinetic energy that would matter would be the kinetic energy of $m_2$. But it seems that I must also consider the kinetic energy used to lift $m_1$ to $h$ as well.
Is this because $m_2$ strikes the ground with the sum of the kinetic energies of $m_1$ and $m_2$ due to conservation, or am I interpreting this result incorrectly?
 A: I think you can argue as follows. We have a tension T acting on both masses. The variation of kinetic energy for $m_1$ is
$$
KE^1_{f} - KE^1_{i} = \int_0^h (- m_1 g + T) \  dx,
$$
while for $m_2$ we have
$$
KE^2_{f} - KE^2_{i} = \int_h^0 (- m_2 g + T) \  dx = \int_0^h (m_2 g - T) \  dx.
$$
Therefore
$$
KE^1_{f} - KE^1_{i} + KE^2_{f} - KE^2_{i} = \int_0^h (- m_1 + m_2)g \  dx,
$$
namely
$$
\frac{1}{2} (m_1 v^2 + m_2 v^2) = (m_2-m_1) g h.
$$
From this latter equation you can find $h$.
A: You're assuming you're calculating the kinetic energy right before the mass hits the ground.
If the mass strikes the ground, it will naturally lose nearly all of its kinetic energy to liberate heat, make sound, create deformations, and possibly displace the plane.  You'd have to account for the energy that went into these processes if you want to use conservation of energy.
A: After thinking about this for a while I came up with an explanation...but I'm not sure how correct it is.
First we define the system as both $m_1$, $m_2$ and earth. We call the floor the 0 potential plane. We can ignore friction because the pully is ideal.
At the start, before the weight is released we can do an analysis.
$E_i = K + U$
Considering kinetic energy, neither object is moving. So this term is $0$ for both masses. Considering potential energy, $m_1$ is on the $0$ potential plane so it has no potential energy, and $m_2$ has potential energy equal to $m_2gh$.
When we release them, $m_2$ falls. Gravity is a conservational force so we expect that the end energy must equal the initial $m_2gh$.
Doing the same analysis after the $m_2$ hits the ground:
There is some kinetic energy in $m_2$ equal to $\frac{m_2v^2}{2}$.
There is some kinetic energy in $m_1$ equal to $\frac{m_1v^2}{2}$ used to bring it up to the height h. There is also potential energy because $m_1$ is now suspended, equal to $m_1gh$.
When considering this entire system the total energy must be:
$\frac{m_2v^2}{2} + \frac{m_1v^2}{2} + m_1gh = m_2gh$
As $m_2$'s entire potential energy is consumed both in it's drop from $h$, as well as raising $m_1$. [THIS IS WHERE I'M SPECULATING] The remainder of this energy is stored in $m_1$ once it comes to rest at $h$.
Where I was confused was I was thinking about each object individually. I had not considered that some of $m_2$'s potential energy is "transferred" into $m_1$ since the system has to be conservative. If this is correct I think I understand it. If not, I would really like some help!
A: The Energy is:
$$E=\underbrace{\frac 12 m_1\,v^2+\frac 12 m_2\,v^2}_{K_E}-\underbrace{\left(m_1\,g\,h_1-m_2\,g\,h_2\right)}_{P_E}=0$$
at $~t=0~$ you obtain the initial energy
$$E_i=E(v=0~,h_1=0)=m_2\,g\,h_2$$
with the conservation of the energy $~E=\text{const.}~$ you can obtain the final velocity when $~m_2~$ collides  with the floor.
$$E=E_i=\text{const}\quad \Rightarrow\\
v={\frac {\sqrt {2}\sqrt { \left( m_{{1}}+m_{{2}} \right) m_{{1}}\,g\,{\it 
h_1}}}{m_{{1}}+m_{{2}}}}\bigg|_{h_1=h_2=h}
$$
