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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:28:26+00:00 2026-05-16T17:28:26+00:00

I have a class wich is initialized like this. // myclass.h @property(nonatomic,retain) NSMutableArray *daysOfWeek;

  • 0

I have a class wich is initialized like this.

// myclass.h
@property(nonatomic,retain) NSMutableArray *daysOfWeek; // this is in .h file

// myclass.m
@synthesize daysOfWeek;

-(id)init {
            if(self=[super init]) {
                    // initialize days of week
                    self.daysOfWeek = [NSMutableArray arrayWithCapacity:0];
            }
            return self;
    }

however later during application lifecycle, seems that daysOfWeek get freed. If I add retain in init method:

self.daysOfWeek = [[NSMutableArray arrayWithCapacity:0] retain];

then everything works as expected, and I can add and retrieve object from daysOfWeek.
I tought that synthesize would retain the daysOfWeek, what am I missing here ?

thanks

  • 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-16T17:28:27+00:00Added an answer on May 16, 2026 at 5:28 pm

    The problem lies somewhere else. Your original init is fine.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The surrounding slashes are just the regex delimiters. You can… May 16, 2026 at 5:29 pm
  • Editorial Team
    Editorial Team added an answer The problem is that you are redefining the ControlTemplate without… May 16, 2026 at 5:29 pm
  • Editorial Team
    Editorial Team added an answer I ended up ditching the Timer approach and used a… May 16, 2026 at 5:28 pm

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

I have class Employee which is something like this. class Emp { int EmpID;
Ok, I'me getting real dumb with this one.... I have this class: Public Class
Sup Guys, I Have a Function on my frmMain Class wich will update my
Ok, so I have a class for a Advanced Data Structure (in this case
I have a movieclip wich has a simple movement of a simple shape. This
Somewhere in my code I have: class aclass { ... function amethod() { $this->dom
I have a unit wich defines TBla and the following code in the initialize
I have a class Person which can have several Homes, each one with one
i have a class A that needs to instantiate a second class B, whose
I need some pretty approach to load polymorhic object I have base class and

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.