Thermal degradation of polymers and flame retardants