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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:37:11+00:00 2026-06-06T18:37:11+00:00

Possible Duplicate: alloc, init, and new in Objective-C I am a little confused about

  • 0

Possible Duplicate:
alloc, init, and new in Objective-C

I am a little confused about [Class new] and [[Class alloc] init]. I have defined an object content using [Class new] and [[Class alloc] init].

(1). NSMutableArray *content = [NSMutableArray new];
(2). NSMutableArray *content = [[NSMutableArray alloc] init];

My question is about the differences between [Class new] and [[Class alloc] init]. For me, (1) and (2) are similar. If (1) and (2) are similar, then why do we use [[Class alloc] init] most of the time, compared to [Class new]? I think that there must be some difference.

Kindly explain the differences, pros & cons of both?

  • 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-06-06T18:37:12+00:00Added an answer on June 6, 2026 at 6:37 pm

    Alloc: Class method of NSObject. Returns a new instance of the receiving class.

    Init: Instance method of NSObject. Implemented by subclasses to initialize a new object (the receiver) immediately after memory for it has been allocated.

    New: Class method of NSObject. Allocates a new instance of the receiving class, sends it an init message, and returns the initialized object.

    Release: Instance method of NSObject delegate. Decrements the receiver’s reference count.

    Autorelease: Instance method of NSObject delegate. Adds the receiver to the current autorelease pool.

    Retain: Instance method of NSObject delegate. Increments the receiver’s reference count.

    Copy: Instance method of NSObject delegate. Returns a new instance that’s a copy of the receiver.

    So to conclude we can say that

    alloc goes with init

    new = alloc + init

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

Sidebar

Related Questions

Possible Duplicate: alloc, init, and new in Objective-C There is +alloc/-init... and +new .
Possible Duplicate: How to copy an object in objective c I have a very
Possible Duplicate: Objective-C: With ARC, what's better? alloc or autorelease initializers? Does ARC automatically
Possible Duplicate: Why is object not dealloc'ed when using ARC + NSZombieEnabled I've got
Possible Duplicate: Class methods which create new instances How would you declare a constructor
Possible Duplicate: deep copy NSMutableArray in Objective-C ? I have two arrays of length
Possible Duplicate: Objective C alloc/release error When I try the code below it crashes
Possible Duplicate: Convert NSArray to NSString in Objective-C I have an array of an
Possible Duplicate: NSString @property, using copy instead of retain I have a basic memory
Possible Duplicate: NSString retainCount is 2147483647 Let say i have an class named as

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.