• 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
Re: NSCreateMapTable - capacity argument clarification?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCreateMapTable - capacity argument clarification?


  • Subject: Re: NSCreateMapTable - capacity argument clarification?
  • From: leenoori <email@hidden>
  • Date: Fri, 22 Dec 2006 21:27:03 +0100

El 5/12/2006, a las 1:27, Jim Correia escribió:

The documentation for NSCreateMapTable says:

Creates and returns a pointer to an NSMapTable in the default zone; the
table’s size is dependent on (but generally not equal to) capacity. If
capacity is 0, a small map table is created.


Does this simply establish the initial capacity (as it does with NSMutableDictionary) and the map table will grow as needed? (Given that 0 is a valid initial capacity, it would appear so, but...)

Or does the capacity define an upper bounds on the number of items allowed in the table? (This is the convention CFMutableDictionary uses for all non-zero initial capacities.)

I too was asking myself this question today but I couldn't find any answers in the list archives. So I did a couple of quick tests:


- in one, I passed 0 as an initial capacity and then inserted 1,000 key/object pairs: I was then able to enumerate over the map table and there were indeed 1,000 pairs.

- in the other test, I passed a small but non-zero initial capacity (64, actually) and then did the same with 1,000 key/object pairs and got the same results (1,000 pairs).

So it appears that on the current version of Mac OS X, tables can grow beyond their initial capacity. Of course, before relying on this assumption in shipping code you'd probably want official clarification from Apple, or at worst some tests of your own using limits specific to your needs.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSCreateMapTable - capacity argument clarification? (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: [RS] multiple beepage
  • Next by Date: RE: Undo with Table View and array controller
  • Previous by thread: NSCreateMapTable - capacity argument clarification?
  • Next by thread: problems with modal window and menu command
  • Index(es):
    • Date
    • Thread