Investigation of nanoscale mechanisms driving erosion and pitting in graphitic carbon