mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 11:57:38 +02:00
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:
parent
a3beaaa3af
commit
7539980eb1
5 changed files with 40 additions and 28 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue