Memory Questions

Posts: 215
Joined: 2008.06
Post: #1
A few things have cropped while making sure my engine plays nice with memory resources:

1. Do automatic properties release old values before assigning the new ones?
2. Does the following code follow proper memory management?

Object* foo = [bar spawnNewObject];
[foo doSomething];
[bar release];
bar = nil;
[self setBar:foo];

[foo release];

3. If not, what is a good way to do the above?

Mac users swear by their computers, PC users swear at their computers. ~Unknown

Quote this message in a reply
Posts: 869
Joined: 2003.01
Post: #2
1.) read the docs, you can configure the behavior of properties via attributes.

2.) it's not entirely clear, it depends on what each of the methods called does.

3.) create a new hypothetical situation?
Quote this message in a reply
Post Reply