{"id":3815,"date":"2014-03-30T05:52:19","date_gmt":"2014-03-30T05:52:19","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/temporary-release-memory-collection-of-common-programming-errors\/"},"modified":"2014-03-30T05:52:19","modified_gmt":"2014-03-30T05:52:19","slug":"temporary-release-memory-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/temporary-release-memory-collection-of-common-programming-errors\/","title":{"rendered":"Temporary release memory-Collection of common programming errors"},"content":{"rendered":"<p>I am creating a quiz app in iPhone. So that i have so many labels and buttons in use at a time. If i release them right after one question then application stops.<\/p>\n<p>If i am not doing that and releasing them at dealloc function then it shows memory warning and app crashes. I am using this Code<\/p>\n<p>received memory warning. level 1<\/p>\n<p>If i set around 20 questions then application is not crashing but if i add more questions then it crashes..<br \/>\nI think it is allocating memory and not releasing right after one question.<\/p>\n<p>Please help me out this:(<\/p>\n<p>Edited :<br \/>\nI am using this code after selecting answer<\/p>\n<pre><code>-(void)checkAnswer:(int)theAnswerValue\n{   \n[AVback stop];\n[scrollview scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO]; \n[Challengetext setHidden:YES];\n[theScore setHidden:YES];\n[theQuestion setHidden:NO];\n[Question setHidden:YES];  \nif(rightAnswer == theAnswerValue)\n{\n    NSString *AVpath = [[NSBundle mainBundle] pathForResource:@\"Winner_1\" ofType:@\"m4a\"];\n    AVAudioPlayer *AVbtn1 = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:AVpath] error:NULL];\n\n\n    [img1 setHidden:NO];\n    [img2 setHidden:YES];\n    [theQuestion setFont:[UIFont fontWithName:@\"Futura\" size:30]];\n    theQuestion.textColor = [UIColor purpleColor];\n    theQuestion.text = @\"\\n\\nCorrect Answer!!\";\n    [rightans setHidden:NO];\n    [Description setHidden:NO];\n    [ContainerView setHidden:NO];\n    myScore = myScore + 50;\n}\nelse\n{\n\n    NSString *AVpath = [[NSBundle mainBundle] pathForResource:@\"incorrect2\" ofType:@\"m4a\"];\n    AVAudioPlayer *AVbtn1 = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:AVpath] error:NULL];\n    QuizAppUniversalAppDelegate *appDelegate = (QuizAppUniversalAppDelegate *) [[UIApplication sharedApplication] delegate];\n    if(appDelegate.soundIndicator == 0){\n        [AVbtn1 play];\n\n    }\n    else{\n        [AVback stop];\n        [AVstart stop];\n        [AVbtn1 stop];\n    }\n\n    [img2 setHidden:NO];\n    [img1 setHidden:YES];\n    [theQuestion setFont:[UIFont fontWithName:@\"Futura\" size:30]];\n    theQuestion.textColor = [UIColor redColor];\n    theQuestion.text = @\"\\nIncorrect Answer!!\\nRight answer is : \\n \";\n    [rightans setHidden:NO]; \n    [Description setHidden:NO];\n    [ContainerView setHidden:NO];\n    myScore = myScore ;\n\n}\n<\/code><\/pre>\n<p>Thanks.. Any help will be appreciated.. !!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am creating a quiz app in iPhone. So that i have so many labels and buttons in use at a time. If i release them right after one question then application stops. If i am not doing that and releasing them at dealloc function then it shows memory warning and app crashes. I am [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3815","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3815"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3815\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}