In Google Maps API v2, if I wanted to remove all the map markers, I could simply do:
map.clearOverlays();
How do I do this in Google Maps A
Google's Demo Gallery has a demo on how they do it:
http://code.google.com/apis/maps/documentation/javascript/examples/overlay-remove.html
You can view the source code to see how they add markers.
Long story short, they keep the markers in a global array. When clearing/deleting them, they loop through the array and call ".setMap(null)" on the given marker object.
However, this example shows one 'trick'. "Clear" for this example means removing them from the map but keeping them in the array, which allows the application to quickly re-add them to the map. In a sense, this acts like "hiding" them.
"Delete" clears the array as well.