Fixed memory allocation in Unique to not allocate too much memory

myisam/mi_info.c:
  Updated comments
mysys/tree.c:
  Added comment
sql/net_serv.cc:
  Added comment
This commit is contained in:
unknown 2003-06-26 07:56:55 +03:00
commit 7539980eb1
5 changed files with 40 additions and 28 deletions

View file

@ -90,6 +90,11 @@ void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit,
if (!free_element && size >= 0 &&
((uint) size <= sizeof(void*) || ((uint) size & (sizeof(void*)-1))))
{
/*
We know that the data doesn't have to be aligned (like if the key
contains a double), so we can store the data combined with the
TREE_ELEMENT.
*/
tree->offset_to_key=sizeof(TREE_ELEMENT); /* Put key after element */
/* Fix allocation size so that we don't lose any memory */
default_alloc_size/=(sizeof(TREE_ELEMENT)+size);