Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Memory management

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa
Mac Cocoa  
Author Message
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Fri Sep 12, 2008 2:43 pm    Post subject: Memory management Reply with quote

Technical Q&A QA1367 - Finding EXC_BAD_ACCESS bugs in a Cocoa project

"This kind of problem is usually the result of over-releasing an object. It can
be very confusing, since the failure tends to occur well after the mistake is
made. The crash can also occur while the program is deep in framework code,
often with none of your own code visible in the stack."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3036
Location: Europe

PostPosted: Sat Sep 13, 2008 12:20 am    Post subject: Reply with quote

adc - Object Ownership and Disposal

"This document discusses the policy for ownership of Objective-C objects and
how and when to dispose of objects.

To fully understand how the object ownership policy is implemented in Cocoa,
you must also read Autorelease Pools."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Fri Sep 19, 2008 11:34 pm    Post subject: Reply with quote

SO - Understanding reference counting with Cocoa / Objective C

"I'm just beginning to have a look at Objective C and Cocoa with a view to
playing with he iPhone SDK. I'm reasonably comfortable with C's malloc and
free concept, but Cocoa's references counting scheme has me rather confused.
I'm told it's very elegant once you understand it, but I'm just not over the
hump yet."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon Oct 06, 2008 1:01 am    Post subject: Reply with quote

SO - Avoiding, finding and removing memory leaks in Cocoa

"Memory (and resource) leaks happen. How do you make sure they don't?

What tips & techniques would you suggest to help avoid creating memory
leaks in first place?"
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3036
Location: Europe

PostPosted: Sat Oct 11, 2008 7:50 pm    Post subject: Reply with quote

SO - What is the cost of using autorelease on obj-c objects?

"Most of Apples documentation seems to avoid using autoreleased objects
especially when creating gui views, but I want to know what the cost of using
autoreleased objects is?"
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3036
Location: Europe

PostPosted: Mon Dec 01, 2008 8:11 pm    Post subject: Reply with quote

SO - How to deal with low memory warnings on the iPhone?

"I'm having problems with my application receiving low memory warnings
while the user is deep within a navigation controller stack of views."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon Jan 26, 2009 1:05 am    Post subject: Reply with quote

iphonedevsdk.com - Is 8mb too much memory? (didReceiveMemoryWarning)

"You'd be very surprised at how different the environment is from one
device to the next. The iPhone will have 5-10MB less RAM from the get-go
with the extra phone services. Someone who browses heavily can have
another 10-20MB unavailable due to MobileSafari running at all times in
the background."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Thu Jan 29, 2009 1:22 am    Post subject: Reply with quote

iphonedevbook.com - Autorelease question for UITableViewCell

"If we release it ourselves, then the retain count gets set to 0 and the object
might be deallocated before the caller uses it. And if we do nothing, then we
have a memory leak."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3036
Location: Europe

PostPosted: Wed Jun 10, 2009 6:12 pm    Post subject: Reply with quote

MF - Is OS 3.0 GM memory hungry?

"I've been having some weird errors today, since upgrading to 3.0 GM. I
seem to be running out of memory. Nothings changed in my app, I'm in
the final stages of testing."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Fri Jun 19, 2009 11:49 pm    Post subject: Reply with quote

so - How to find available memory in iPhone programmatically?

"I'd like to know how to find programmatically available memory in iPhone
from Objective-C?"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sun May 09, 2010 11:45 pm    Post subject: Reply with quote

SO - Available memory for iPhone OS app

"I'm looking for a device-independent way (iPod touch, iPhone, iPad) to
know how much memory the app has left."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Thu Oct 28, 2010 11:36 pm    Post subject: Reply with quote

so - Get Device Memory Xcode

"The desktop uses the Mach call host_statistics64() to get that information.
You can see it in use in the source code for the vm_stat command."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3036
Location: Europe

PostPosted: Thu Dec 09, 2010 4:58 pm    Post subject: Reply with quote

reddit - Objective-C Memory Management For Lazy People

"What’s got me irked this time around, ... started out with this lazy and inane
blog post: Android vs iOS: A Developer’s Perspective."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sun Oct 23, 2011 3:04 am    Post subject: Reply with quote

MF - What is this new fangled ARC???

"You want to read the Transitioning to ARC Release Notes.

The Automatic Reference Counting section of the Xcode New Features
User Guide tell you about the new Xcode command for converting a pro-
ject to ARC.

You might want to read the Storyboarding section of that same guide.
Storyboarding is another new feature of XCode 4.2 which could make
your job easier.
...

You can turn ARC off per file or per project very easily by setting the
following -fno-objc-arc."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Tue May 22, 2012 1:34 am    Post subject: Reply with quote

LW - Understanding Automatic Reference Counting in Objective-C

"Despite its awesomeness, ARC does not let you ignore memory management
altogether.

Click on the Target
Select the Build Phases tab
Expand the Compile Sources section
Select one or more files you want to exclude from ARC
Press the return key
Type -fno-objc-arc"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Tue Jul 17, 2012 12:21 am    Post subject: Reply with quote

so - performSelector may cause a leak because its selector is unknown

"In the LLVM 3.0 compiler in Xcode 4.2 you can suppress the warning as
follows:"

Code:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
    [self.ticketTarget performSelector: self.ticketAction withObject: self];
#pragma clang diagnostic pop
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3036
Location: Europe

PostPosted: Mon Dec 31, 2018 5:30 pm    Post subject: Reply with quote

a - Transitioning to ARC Release Notes

"Automatic Reference Counting (ARC) is a compiler feature that provides
automatic memory management of Objective-C objects. Rather than having
to think about retain and release operations, ARC allows you to concentrate
on the interesting code, the object graphs, and the relationships between
objects in your application."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sat Jan 12, 2019 9:31 pm    Post subject: Reply with quote

so - performSelector may cause a leak because its selector is unknown

In the LLVM 3.0 compiler in Xcode 4.2 you can suppress the warning as
follows:

Code:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
    [self.ticketTarget performSelector: self.ticketAction withObject: self];
#pragma clang diagnostic pop

If you're getting the error in several places, and want to use the C macro
system to hide the pragmas, you can define a macro to make it easier to
suppress the warning:


Code:
#define SuppressPerformSelectorLeakWarning(Stuff) \
    do { \
        _Pragma("clang diagnostic push") \
        _Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
        Stuff; \
        _Pragma("clang diagnostic pop") \
    } while (0)


You can use the macro like this:

Code:
SuppressPerformSelectorLeakWarning(
    [_target performSelector:_action withObject:self]
);


If you need the result of the performed message, you can do this:

Code:
id result;
SuppressPerformSelectorLeakWarning(
    result = [_target performSelector:_action withObject:self]
);
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3036
Location: Europe

PostPosted: Wed May 26, 2021 3:28 pm    Post subject: Reply with quote

SystemGenes - Stack Size : behind the code

"The stack word is very popular when it comes to C programming. It often
intrigues us that how much is the stack size of a process and how to know it."
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group