Phase change materials (PCMs) such as Ge2Sb2Te5 (GST) undergo a reversible amorphous-to-crystal transition that is the basis of their interest for next generation non-volatile memories. The large density change upon crystallization raises important issues because of the large mechanical stresses occurring during memory cycling. In order to investigate the intimate relationship between stress buildup and microstructure evolution we have built a dedicated setup, which allows combining X-ray diffraction and curvature measurements on DiffAbs beamline at SOLEIL synchrotron. Using a thin (30nm) GST film deposited on Si we show that this setup yields a wealth of interesting results. A clear correlation is observed between phase transition and stress buildup. Detailed information is obtained on the thermomechanical behavior of the different phases. Systematic investigation of PCMs with this original setup will help understanding the thermomechanical behavior of PCM thin films and nanostructures.