Shopify/batman — pull request #185 by pvande (2011-10-18 02:36:23+00:00)
Title: Fix a leak where unknown hash lookups hold refs.

Both the EventEmitter and Observable mixins have an optimizing
behavior where the `event`/`property` method they add autocreates
new Events/Properties on failed lookups. This is all well and
good, but both the Event and Property classes have a bad habit
of traversing the ancestry and calling `event`/`property` on
each ancestor.

When the key in question is a complex object, this has the
unfortunate side-effect of holding references to objects that
should be freed: a memory leak.

For reasons I can't quite understand yet, every instance of every
model class I loaded was being looked up as a Property key, which
despite not being particularly sensible was still effective at
placing a reference to the object on the BatmanObject class and
leaking memory.

This change does nothing to alter the behavior of `event`/
`property`, instead providing a mechanism for querying for the
existence of events / properties and employing it internal to the
Event and Property classes.