Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
C
chashmap
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 11
    • Issues 11
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 3
    • Merge Requests 3
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • redox-os
  • chashmap
  • Merge Requests
  • !3

Merged
Opened Oct 22, 2019 by Alex Hornby@ahornbyContributor

Fix for case where calling shrink_to_fit could make the map larger

  • Overview 0
  • Commits 1
  • Changes 2

Reproduced issue by adding new test shrink_to_fit_after_insert. Checked it was failing before doing any changes

With the test in place fixes were:

  1. Make CHashMap::reserve be the place the amortizing growth factor LENGTH_MULTIPLIER is applied, rather than Table::with_capacity ( non-CHashMap::reserve users of Table::with_capacity are requesting a specific capacity and just need load factor applied, not amortizing growth multiplier )

  2. Apply load factor consistently in Table::with_capacity() vs CHashMap::capacity()

  3. Apply MINIMUM_CAPACITY in CHashMap::capacity to stop reported capacity being below requested.

  4. Add test known_size_with_capacity_matches_shrink to test the initial capacity+shrink case

Tested via cargo test

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Reference: redox-os/chashmap!3
Source branch: shrink_to_fit

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.