Putting on excess weight before the age of 30 could dramatically raise the risk of dying early, a major study suggests.