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

  • Home
  • SEARCH
  • 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 990453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:57:00+00:00 2026-05-16T05:57:00+00:00

I have this UITableView app, a basic diary app, in this method XCode says

  • 0

I have this UITableView app, a basic diary app, in this method XCode says I have a memory leak. The first line that leak is suggested to start is 117 “NSString *CellIdentifier”.
Down to if (cell ==…, to Diary *diaryEntry, to NSString *stringDate.
There it states that the Method returns an object with a +1 retain count, owning.
I’ve tried to release cell, stringDate… nothing changes this fact, so what am I thinking/doing wrong here?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

// A date formatter for the time stamp static 

static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}

Diary *diaryEntry = [diaryArray objectAtIndex:indexPath.row];

cell.textLabel.text = diaryEntry.diaryTitle;

NSString *stringDate = [[DiaryDateFormatter alloc] convertDateToString:[diaryEntry diaryDate]];

cell.detailTextLabel.text = stringDate;    

[stringDate release];
return cell;

}

  • 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-16T05:57:00+00:00Added an answer on May 16, 2026 at 5:57 am

    This line looks problematic:

    NSString *stringDate = [[DiaryDateFormatter alloc] convertDateToString:[diaryEntry diaryDate]];
    
    1. Once you’ve allocated an instance of a class, you need to initialise it. If convertDateToString: is an initialiser method, then it should be renamed. However, it looks like convertDateToString: should be a class method anyway (this way you won’t have to allocate instances of the DiaryDateFormatter class).
    2. The alloc method always gives you an object with a +1 retain count. Therefore it is your responsibility to release it. The way your code is set up means you can no longer access the allocated object in order to release it.

    Try changing the above line of code into this:

    DiaryDateFormatter *formatter = [[DiaryDateFormatter alloc] init];
    NSString *stringDate = [formatter convertDateToString:[diaryEntry diaryDate]];
    [formatter release];
    

    Also, don’t release stringDate, because it was not obtained using a method whose name implies that you have ownership.

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

Sidebar

Ask A Question

Stats

  • Questions 537k
  • Answers 537k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Not really, the only awareness that swfaddress has of the… May 17, 2026 at 1:44 am
  • Editorial Team
    Editorial Team added an answer Wild guess: change <%= @posts.each do |post| %> to <%… May 17, 2026 at 1:44 am
  • Editorial Team
    Editorial Team added an answer Checking if the uploaded file's size is non-zero is not… May 17, 2026 at 1:44 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

In my app delegate, I have this method that gets stubbed out automatically, to
I have a fairly simple iPhone app that downloads a set of UITableView results
I have an app that currently holds all state in memory. It fetches a
I have this error that is keeping me from moving forward. I basically have
I have an app that has a lot of views including tableViews but one
I have a UITableView populated with a bunch of music players that I've made
Sorry but I found no clear answer on that. I have an iphone app
So I'm making a very basic Twitter app (it's actually Presence 2 from the
I have a three view tab bar app the second view of which I
I have an app, which has a top navigation bar and a bottom tab

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.