Memory Managment (copys??)
Memory Managment (copys??)
- Subject: Memory Managment (copys??)
- From: Coleman Nitroy <email@hidden>
- Date: Sat, 5 Feb 2005 16:38:39 -0500
Ok, I am very suprised I got as far as I did without running into a
memory issue. Here is my perplexing problem (its probably something so
very simple).
If I were to do this
NSMutableArray *array = [[NSMutableArray alloc] init];
SOMEObject *object = [[SOMEObject alloc] init];
for ( i = 0; i < 10; i++ ) {
[object setSomeProperty: i];
[array addObject: object];
}
And then print out someProperty for all of the objects in array, I
would get the last property only.. so I would get 10, 9's. I tried
doing:
[array addObeject: [object copy]];
And all I got was 10, 0's. I am baffled. How do I handle this?
---
Coleman Nitroy
email@hidden
nitroy.com/cole
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden