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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:37:41+00:00 2026-05-14T14:37:41+00:00

I was wondering if there are any memory/performance drawbacks, or just drawbacks in general,

  • 0

I was wondering if there are any memory/performance drawbacks, or just drawbacks in general, with using Class Methods like:

+ (void)myClassMethod:(NSString *)param {
// much to be done...
}

or

+ (NSArray*)myClassMethod:(NSString *)param {
// much to be done...
    return [NSArray autorelease];
}

It is convenient placing a lot of functionality in Class Methods, especially in an environment where I have to deal with memory management(iPhone), but there is usually a catch when something is convenient?

An example could be a thought up Web Service that consisted of a lot of classes with very simple functionality. i.e.

TomorrowsXMLResults;
TodaysXMLResults; 
YesterdaysXMLResults;
MondaysXMLResults;
TuesdaysXMLResults;
.
.
.
n

I collect a ton of these in my Web Service Class and just instantiate the web service class and let methods on this class call Class Methods on the ‘Results’ Classes. The classes
are simple but they handle large amount of Xml, instantiate lots of objects etc.

I guess I am asking if Class Methods lives or are treated different on the stack and in memory than messages to instantiated objects?

Or are they just instantiated and pulled down again behind the scenes and thus, just a way of saving a few lines of code?

  • 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-14T14:37:42+00:00Added an answer on May 14, 2026 at 2:37 pm

    Short answer: no downside – use as expected

    Long answer: Classes in objective-c are actually objects, that you can use like anything else (check the return type of -[NSObject class] — a pointer to an obj-c object). When you call [yourclass alloc], you’re actually sending a message to yourclass, which is an object describing the class to the runtime. (the method itself is a bunch of wrappers around malloc(), so there’s not exactly any magic involved.) As far as how these objects are handled, ALL objects in objc, including classes, are allocated in the heap, so the stack plays no part. EDIT: Just to be clear, there is no difference in using a class method as opposed to an instance method, except that with a class method you do not need to have an instance of the class.

    for further reading on how these class objects are implemented, I recommend http://www.sealiesoftware.com/blog/archive/2009/04/14/objc_explain_Classes_and_metaclasses.html

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

Sidebar

Related Questions

Just wondering if there is any way (in C) to get the contents of
Wondering if there is any Text to Speech software available as a plug in
Wondering if there's any not-too-hard way to edit non-form text in html 4. I
I was wondering if there are any alternatives to Microsoft's SQL Server Management Studio?
i'm wondering if there is any nice and neat tool to replace the GNU
I was wondering if there is any way to escape a CDATA end token
I'm wondering if there are any architectural frameworks out there to create desktop or
I'm wondering if there are any simple ways to get a list of all
I am wondering if there are any well-known algorithms that I should be aware
I am wondering if there is any way to list all the calls to

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.