Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 874893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:10:47+00:00 2026-05-15T11:10:47+00:00

i been cracking my head over this memory leak.. my datasource is mutabledictionary..that i

  • 0

i been cracking my head over this memory leak..

my datasource is mutabledictionary..that i load in the viewdidload. if i dont retain it. i dont have access it it in cellforrowatindexpath. but when i retain it.. it shows up as a memory leak in instruments. i have tried so many different variations.. doesnt seem to get it right.

here is the code the leak is in “dict” and “plistPath”

`
– (void)viewDidLoad {
[super viewDidLoad];

self.navigationController.navigationBarHidden = NO;

self.title = @"Messages & Lists";


NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

[plistPath release];
plistPath = [documentsDirectory stringByAppendingPathComponent:@"general.plist"];

NSFileManager *fileManager = [NSFileManager defaultManager];
[dict release];

if ( [fileManager fileExistsAtPath:plistPath] ) {

    dict = [NSMutableDictionary dictionaryWithContentsOfFile:plistPath] ;


} else {
    dict = [NSMutableDictionary dictionaryWithCapacity:1];

    [dict setObject:@"NO" forKey:@"busyStatus"];
    [dict setObject:@"NO" forKey:@"replyToAll"];
    [dict setObject:@"NO" forKey:@"replyToList"];
    [dict setObject:@"NO" forKey:@"dontReplyToList"];

    [dict writeToFile:plistPath atomically:YES];


}

[tableData release];

tableData = [[NSMutableDictionary alloc] init];

[tableData setObject:[NSArray arrayWithObjects:@"Help",@"Set Default Message",@"Reply To All",[dict objectForKey:@"replyToAll"],nil] forKey:@"1"];
[tableData setObject:[NSArray arrayWithObjects:@"Reply to a List",[dict objectForKey:@"replyToList"],@"List of Contacts",nil] forKey:@"2"];
[tableData setObject:[NSArray arrayWithObjects:@"Don't reply to List",[dict objectForKey:@"dontReplyToList"],@"List of Contacts",nil] forKey:@"3"];


[dict retain];  
[plistPath retain];

}

`

there is no leak the first time the view loads. but if i got back. and then load the view again it leaks.

thanks in advance for anyone who can help me out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:10:47+00:00Added an answer on May 15, 2026 at 11:10 am

    You have to call [dict release] in your view controller’s dealloc method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been cracking my head for hours on what I thought to be
been pulling my hair out over this for the past few hours. i have
I've been cracking my head on this one for weeks now. What happens if
Hi I've googled for this...it's been 2 days...this null stuff really cracking my head!
Been stumbling me for over an hour now and that means time to ask
Been Googling this for over an hour, and getting answers to much more complex
the deal is this: I have a MySQL database that is built in this
Been scratching my head at this one for way too long now... $dom =
I've been cracking heads on how to achieve this in C++: string format =
Been stuck on this one for a couple days now...I have an existing Liferay

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.