• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Memory Managment (copys??)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Memory Managment (copys??)
      • From: Sherm Pendley <email@hidden>
    • Re: Memory Managment (copys??)
      • From: Will Mason <email@hidden>
  • Prev by Date: Re: Newbie wallowing in documentation
  • Next by Date: Re: Memory Managment (copys??)
  • Previous by thread: Re: NS(Array)Controller and To-Many Relationships (how to add objectsfrom one to another)
  • Next by thread: Re: Memory Managment (copys??)
  • Index(es):
    • Date
    • Thread