Don't allocate TEvent on the heap.

It is not necessary and it fixes various memory leaks.