summaryrefslogtreecommitdiff
path: root/mysys/tree.c
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-06-26 07:56:55 +0300
committerunknown <monty@mashka.mysql.fi>2003-06-26 07:56:55 +0300
commit7539980eb1e70144c8f1232271e4f24311426312 (patch)
tree80a9ea494fdef18a20b754a4ce6bfd8179e5cfe0 /mysys/tree.c
parenta3beaaa3af7af26aabadda6836618d32d6c90e51 (diff)
downloadmariadb-git-7539980eb1e70144c8f1232271e4f24311426312.tar.gz
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
Diffstat (limited to 'mysys/tree.c')
-rw-r--r--mysys/tree.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mysys/tree.c b/mysys/tree.c
index ea5cf79f084..2b5ea717809 100644
--- a/mysys/tree.c
+++ b/mysys/tree.c
@@ -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);