Timeline for Pset8 Mashup removeMarkers not working
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 28, 2018 at 7:46 | comment | added | sk.76 | @PeterPesch It's good to know that! | |
Oct 28, 2018 at 7:43 | comment | added | Peter Pesch | sk.76 Yes, of course, I'm learning all the time. Communication is (and always has been) my weakest point. | |
Oct 28, 2018 at 7:28 | comment | added | sk.76 | @PeterPesch I acknowledge the fact that you have a different opinion and also,I had hastily made some wrong conclusions for the answer to the question asked above. I did realize that I left a part of the answer and so, my conclusion regarding garbage values was wrong. But this does not imply that you can or have to be impatient on such a big discussion forum. I expect that you will learn the patience to wait and listen to others. | |
Oct 27, 2018 at 10:57 | comment | added | Peter Pesch | @sk.76 I added that comment because I realised I am quite heavily object to (parts of) this particular answer. I think you are a very valuable member. So I would hate it if you would leave just because I have a different opinion on one of your answers ... | |
Oct 27, 2018 at 10:32 | comment | added | sk.76 | @PeterPesch I do answer question,it may take quite a while for that but I do make sure to get back.I don't understand why you are pointing on that? | |
Oct 24, 2018 at 16:39 | comment | added | Peter Pesch | By the way: Please do keep answering questions! | |
Oct 24, 2018 at 16:36 | comment | added | Peter Pesch |
@sk.76 Exactly. They are hidden. But in your version, they will still exist. Have another look at the documentation (developers.google.com/maps/documentation/javascript/examples/…). There it says about setMapOnAll() : "Removes the markers from the map, but keeps them in the array." Yonatan's version probably takes care of that by his line markers = []; . But your (one-line) version of removeMarkers() fails to do that ... Your markers array will keep growing. And you don't even set it's elements to NULL, so garbage collection will not work ...
|
|
Oct 24, 2018 at 16:12 | comment | added | sk.76 | @Peter Pesch If you take a closer look into the setMapOnAll() function and the markers[] array and the removeMarker function,you will find that the markers[] array has been filled using addMarkers() and in the setMapOnAll() function, we actually are setting a null map on all those markers that are existing in the array. So, we create no new array marker elements here so,no memory issues.Essentially those preexisting markers at the time of updation are going to be hidden on a null map. | |
Oct 22, 2018 at 20:23 | comment | added | Peter Pesch | @sk.76 But that way you wouldn't actually delete the markers. Wouldn't the server run into memory problems, if it keeps creating more and more new markers, adding them to the markers list, and turning them off (i.e. hiding them)? | |
Oct 22, 2018 at 8:03 | comment | added | Yonatan Spira | Thanks for trying to help, that line of code is from the google documentation, that function is one they have created, I wrote the exact same thing in my code in removeMarkers. However, I accidentally used square brackets instead of regular: I wrote markers[i].setMap[null], and couldn't see it at the time. Today went over it all slowly again and saw it immediately. That's how the brain works I guess. | |
Oct 21, 2018 at 14:54 | history | answered | sk.76 | CC BY-SA 4.0 |