The main code is like this too:
ReportScrollView.h file
NumberView * scoresView ;/ / total score View.NumberView is custom
ReportScrollView.m file
- (Void) initData
{
/ / Add scores
scoresView = [[NumberView alloc] initWithFrame: CGRectMake (0,0,100,100)];
[ScoresView setNum: 90];
[Self addSubview: scoresView];
}
/ / Data released
- (Void) dealloc
{
if (scoresView! = nil)
[ scoresView release];
[Super dealloc];
}
NumberView.m
- (Void) dealloc {
[Super dealloc] ;/ / run to here, there EXC_BAD_ACCESS error, seeking answers, thanks!
}
Reply:
This problem usually occurs by the excessive release of a block of memory is called reason, that is, when the memory of a memory counter is already 0 call release again, will be out of the question, so please confirm whether the repeated release scoresView the? Specifically check release.
Reply:
The problem is likely to come from NumberView class
Reply:
But [scoresView release]; Before I print retainCount, the value is 1, after release to 0, so it automatically calls the dealloc function scoresView, I do not understand is [super dealloc]; in the end do what action he What mechanism is, I put [super dealloc] scoreViewdealloc within commented after no problem, but worried that there will be a memory leak
Reply:
Use NSZombie find duplicate release objects
Reply:
Class members scoresView Are there times RELEASE?
Reply:
retainCount This value is only theoretical, in the debugging process, often incorrectly phenomenon.
Reply:
EXC_BAD_ACCESS usually occurs because the object already been released, once again release
Reply:
In place behind ReportScrollView.m in scoresView release plus a scoresView = nil try in general viewUnload so dry
Reply:
Hello everyone, the problem has been resolved, so I re-addsubview when a new application via the control alloc release it, and then dealloc function and release it, thus leading to duplication of release, control calls upon release [ super dealloc] after the internal controls automatically sends a release message, it is just a place in one of two places can be released, or when, after addsubview, either in dealloc function, generally temporary in addsubview After the release, the class member variables, then released in the dealloc, you can not operate both places will be released, thank you for your answer, the score is limited, I gave the order!
No comments:
Post a Comment