A process for the production of a copolymer, which comprises heat-treating a raw copolymer comprising units of a vinyl monomer and 5 to 50% by weight of a methacrylic and/or acrylic acid unit in the presence of 0.01 to 0.5% by weight of a basic compound, thereby converting the methacrylic and/or acrylic acid unit into a six-membered cyclic anhydride unit, wherein the vinyl monomer is a member selected from the group consisting of methacrylic esters, acrylic esters and aromatic vinyl compounds, and the basic compound is a member selected from the group consisting of alkali metal hydroxides or carbonates, alkaline earth metal hydroxides, organic carboxylic acid alkali metal salts and alkali metal alkoxides.