Commit fc6f8a69 authored by Ben Noordhuis's avatar Ben Noordhuis
Browse files

events: fix memory leak, don't leak event names

Before this commit, events were set to undefined rather than deleted
from the EventEmitter's backing dictionary for performance reasons:
`delete obj.key` causes a transition of the dictionary's hidden class
and that can be costly.

Unfortunately, that introduces a memory leak when many events are added
and then removed again. The strings containing the event names are never
reclaimed by the garbage collector because they remain part of the
dictionary.

That's why this commit makes EventEmitter delete events again. This
effectively reverts commit 0397223a.

Fixes #5970.
parent 3398cce1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment