DescriptionVM: Fix memory leak during shutdown
The way runtime/platform/hashmap.h:HashMap was implemented so far did not allow
deleting elements while iterating over the map. If one iterated like this
HashMap::Entry* cursor = map.Start();
while (cursor != NULL) {
if (cond) {
map.Remove(cursor->key, cursor->hash);
}
cursor = map.Next(cursor);
}
Then the iteration `cursor` will skip elements. This is due to the fact that
`HashMap::Remove()` is left-rotating elements in certain cases and
`HashMap::Next()` will unconditionally advance to the next position in the
backing store.
PROBLEM IS: There was existing code which did remove elements while iterating
over a HashMap.
R=fschneider@google.com
Committed: https://github.com/dart-lang/sdk/commit/d822f36f154340f286efe6df9abb17007c1a4d79
Patch Set 1 #
Total comments: 8
Patch Set 2 : adressed comments #Patch Set 3 : Simplify socket.cc by not updating hashmaps during shutdown #
Messages
Total messages: 13 (4 generated)
|