Magmas contain varying amounts of dissolved gases(volatiles) held in the molten rock by cons fining pressure, just as carbon dioxide is held in cans and bottles of soft drinks. As with soft drinks, as soon as the pressure is reduced, the gases begin to escape, obtaining gas samples from an erupting volcano is difficult and dangerous, so geologists usually must estimate the amount of gas originally contained within the magma .