Re: [squeak-smalltalk/squeak-object-memory] Avoid growth when filling large collections (Issue #160)

smalltalking via Squeak-dev <[email protected]> Wed, 17 Jun 2026 04:57:13 -0700
Newsgroups gmane.comp.lang.smalltalk.squeak.general
Message-ID <squeak-smalltalk/squeak-object-memory/issues/160/[email protected]>
smalltalking left a comment (squeak-smalltalk/squeak-object-memory#160)

In case of HashedCollections, and OrderedCollections, #new: guarantees that the collection can fit the given number of elements without growing.
The title of the issue suggests that it does not work that way. If that is the case, it's a bug that needs to be fixed.

In case of your example, passing `allObjects size * 4 // 13 + 16` instead of `allObjects size` is unnecessary if that is all the elements you want to store in your collection.

Do you have an example where growth happens during #new: or while filling the collection with exactly that many elements?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/squeak-smalltalk/squeak-object-memory/issues/160#issuecomment-4729689629
You are receiving this because you commented.

Message ID: <squeak-smalltalk/squeak-object-memory/issues/160/[email protected]>

Squeak-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]