On 15 May 2012 14:29, Joakim Karlsson <
joa...@jkarlsson.com> wrote:
> Good point about the inconsistency between allocating and deallocating
> ContextRunners. But that wouldn't show up as a memory leak in a normal
> run, right?
It shouldn't. I only really bring it up because it would probably be a good
idea to fix it and there is a small chance that the person did a memory leak
check but somehow forgot to run the tests (Well... pretty unlikely...)
> I'll look at the ListenerAggregator and TestListeners later.
In my opinion, it should just be a matter of adding a method to clear
the listeners. In virtually every case it's not going to be a problem.
But again, if for some reason you want to run the tests twice with
different listeners (not possible at the moment), it would be necessary.
Again, the reason I brought it up is that the original poster may have
not realized that the memory was not owned by ContextRunner.
If you new() a listener and send the pointer to AddListener(),
you will leak memory if you don't delete it later. Personally, I think
that is correct behavior in this case. Possibly the listeners could
be passed by reference instead of by address to underline the
fact that you need to dispose of the memory yourself.
I didn't notice anything else that looked like it could leak memory,
but it's possible I overlooked something...
MikeC