Google Maps setMap(null) does not work

I try to delete markers on the map by using setMap(null) but it does not work. Do you have any idea or solution for this?

Here my delete method:


  for (var i = 0; i < gmarkers.length; i++) 



Could you provide some information on what library you are using to include Google Maps in your app? There are lots, so without that information we just had to guess…