// TEST_CONFIG MEM=mrc
-/*
-TEST_RUN_OUTPUT
-objc\[\d+\]: Deallocator object 0x[0-9a-fA-F]+ overreleased while already deallocating; break on objc_overrelease_during_dealloc_error to debug
-OK: bigrc.m
-OR
-no overrelease enforcement
-OK: bigrc.m
-END
- */
#include "test.h"
#include "testroot.i"
-(void)dealloc
{
id o = self;
- size_t rc = 1;
- testprintf("Retain a lot during dealloc\n");
+ testprintf("Retain/release during dealloc\n");
- testassert(rc == 1);
- testassert([o retainCount] == rc);
- do {
- [o retain];
- if (rc % 0x100000 == 0) testprintf("%zx/%zx ++\n", rc, LOTS);
- } while (++rc < LOTS);
-
- testassert([o retainCount] == rc);
-
- do {
- [o release];
- if (rc % 0x100000 == 0) testprintf("%zx/%zx --\n", rc, LOTS);
- } while (--rc > 1);
-
- testassert(rc == 1);
- testassert([o retainCount] == rc);
-
-
- testprintf("Overrelease during dealloc\n");
-
- // Not all architectures enforce this.
-#if !SUPPORT_NONPOINTER_ISA
- testwarn("no overrelease enforcement");
- fprintf(stderr, "no overrelease enforcement\n");
-#endif
+ testassertequal([o retainCount], 0);
+ [o retain];
+ testassertequal([o retainCount], 0);
[o release];
+ testassertequal([o retainCount], 0);
[super dealloc];
}