add test to detect memory leaks in the event manager (#1948)