Heavy metals, such as lead, cadmium, and mercury, can indeed accumulate in compost if certain contaminated materials are used. These can originate from urban soils, industrial byproducts, or certain household items. It's important to avoid adding materials known to contain heavy metals, like some electronics waste or metal-treated materials. Regular testing of compost can help ensure it remains free from significant heavy metal contamination.