Contamination in electron microscopes can be a serious problem in STEM or in situations where a number of high resolution micrographs are required of the same area in TEM. In modern instruments the environment around the specimen can be made free of the hydrocarbon molecules, which are responsible for contamination, by means of either ultra-high vacuum or cryo-pumping techniques. However, these techniques are not effective against hydrocarbon molecules adsorbed on the specimen surface before or during its introduction into the microscope. The present paper is concerned with a theory of how certain physical parameters can influence the surface diffusion of these adsorbed molecules into the electron beam where they are deposited in the form of long chain carbon compounds by interaction with the primary electrons.