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 772971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:53:21+00:00 2026-05-14T18:53:21+00:00

Please clarify, how to deal with returned objects from methods? Below, I get employee

  • 0

Please clarify, how to deal with returned objects from methods?

Below, I get employee details from GeEmployeetData function with autorelease,

  1. Do I have to retain the returned object in Process method?
  2. Can I release *emp in Process function?

    -(void) Process
    {
    Employee *emp = [self GeEmployeetData]
    }

    +(Employee*) GeEmployeetData{

    Employee *emp = [[Employee alloc]init];
    //fill entity

    return [emp autorelease];
    }

  • 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-14T18:53:22+00:00Added an answer on May 14, 2026 at 6:53 pm

    99% of the time you should retain autoreleased objects returned from other methods if you want to keep them around.

    With autoreleased objects, when the pool is drained, the objects in the pool get sent the release message. That is why 99% of the time you will want to retain autoreleased objects, because the chances of you getting an object with a retainCount of more than 1 is highly unlikely.

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

Sidebar

Related Questions

I have the following code, could anyone please clarify my doubt below. public static
Please help, clarify this issue, I have seen it on many sites now, you
Can anyone please clarify what this query will return ? SELECT TestCase FROM MyTable
Can someone please clarify the following; if a have the following model; presentation-->slide-->video where
could you please clarify my issue? I have a starting page ListBox1.aspx that calls
Hi I have some doubts in the memory allocation of the reference types.Please clarify
Can you please clarify how it is that self.add(x) below works the same way
please clarify me on the below questions, who will do the great data model
I'm kinda of new to PHP, can you please clarify about the below preg_match.
Can you please clarify about the perimeter variable in the below class. I understand

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.