Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1074701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:09:59+00:00 2026-05-16T21:09:59+00:00

When a hash table is initialized how is memory is allocated for it? When

  • 0

When a hash table is initialized how is memory is allocated for it? When we add new members to it how does the memory used by the hash table get extended? Does it ever happen that a hash table is not able to store objects after a fixed size?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T21:10:00+00:00Added an answer on May 16, 2026 at 9:10 pm

    You can use .NET reflector to find out.

    System.Collections.Hashtable has some hard limits in it:

    double num = ((float) capacity) / this.loadFactor;
    if (num > 2147483647.0)
    {
        throw new ArgumentException(Environment.GetResourceString("Arg_HTCapacityOverflow"));
    }
    

    Also keep in mind the value of int.MaxSize for capacity (I think capacity might be the same as the bucket count, depending on load factor).

    If you’re hitting that size limit, though, you may want to look into better storage methods than an in-memory hash table CLR object…

    Edit:

    Memory for the hash table is allocated in this manner:

    int num2 = (num > 11.0) ? HashHelpers.GetPrime((int) num) : 11;
    this.buckets = new bucket[num2];
    
    [StructLayout(LayoutKind.Sequential)]
    private struct bucket
    {
        public object key;
        public object val;
        public int hash_coll;
    }
    

    See Will’s answer for what HashHelpers.GetPrime does.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I notice that a hash table (or any other data structure built on
Are there any built-in C# data structures that are like a hash table but
While calculating the hash table bucket index from the hash code of a key,
I am using a hash table in JavaScript, and I want to show the
I'm want to use either a hash table or a dictionary in my access
How can I store a hash table with separate chaining in a file on
After being taught how to create a hash table in class, I don't understand
What is the most straightforward way to create a hash table (or associative array...)
So if I have to choose between a hash table or a prefix tree
I'm quite confused about the basic concepts of a Hash table. If I were

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.