• unknown's avatar
    Bug#25175 Too much memory used by MySQL grant system · 00182991
    unknown authored
    Each time the server reloads privileges containing table grants, the 
    system will allocate too much memory than needed because of badly
    chosen growth prediction in the underlying dynamic arrays.
    
    This patch introduces a new signature to the hash container initializer
    which enables a much more pessimistic approach in favour for more
    efficient memory useage.
    
    This patch was supplied by Google Inc.
    
    
    include/hash.h:
      * New signature for _hash_init.
      * Defined new function hash_init2 which takes growth_size argument.
    mysys/hash.c:
      * New signature for _hash_init.
    sql/sql_acl.cc:
      * Changed hash_init signature so that it takes a 'growth_size' smaller
      than the default. Each time a GRANT_TABLE is allocated a pre-allocated
      dynamic array is instantiated. A large growth size can result in too
      many unused hash-entries per table-entry and thus be a waste of free
      memory.
    00182991
hash.c 17.5 KB