Unit Test to check the release of an object

What I'm looking for is a way to programmatically verify that the target has been freed. I currently have an NSLog statement in the dealloc methods of the objects I want to observe. The unit testing framework is in the Google Toolbox for Mac, and it works well. I'm just not sure how to create this particular test.

+3
source share
7 answers

Use _GTMDevLog:

See Advanced Material | Unit Test Record on this page .

Learn more about DevLogNAssert .

+2
source

dealloc. . MethodSwizzling CocoaDev; method_exchangeImplementations Leopard ( ) .

, . , , dealloc; NO, , , .

+2

, , , . , .

+1

dealloc - , , , dealloc. , , dealloc'd...

0

, unit test

  • ,
  • ,
  • - ,
  • , ?
0

Ive , YES, :

BOOL getsDeallocatedByReleasing(id object);

Theres , , bool, , :

BOOL classGetsDeallocated(Class c, void (^block)(void));

swizzling, , , , . GitHub, , - .


P.S. (doh!), retain, , , , , , ?

0

Source: https://habr.com/ru/post/1699663/


All Articles