Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixed memory leaks in expectations and matchers #28

merged 1 commit into from Mar 9, 2013


None yet
2 participants

ghost commented Mar 9, 2013

We used Instruments to profile our specs after leaked objects began to cause test pollution. We tracked the issue down to both the expect() macro and any matcher that took a parameter, such as equal().

For example:


will leak my object because the -[EXPExpect actualBlock] property is not released when the expectation is released.

The matcher in this assertion also leaks:


because the EXPBlockDefinedMatcher does not release any of the blocks it retains.

There were also a pair of other simple memory management bugs which we fixed:

  • the block returned from -[EXPDynamicPredicateMatcher dispatch] was not autoreleased
  • The dynamic matcher methods created by _EXPMatcherImplementationBegin would not release the EXPBlockDefinedMatcher *matcher


Christian and Ted


petejkim commented Mar 9, 2013

thanks!!! i didn't catch those merging pull requests

@petejkim petejkim added a commit that referenced this pull request Mar 9, 2013

@petejkim petejkim Merge pull request #28 from pivotaltracker/master
Fixed memory leaks in expectations and matchers

@petejkim petejkim merged commit abc3d83 into specta:master Mar 9, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment