From 5f556f11e0e0ef0daefd41829cd400cc7addb583 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Thu, 26 Jun 2003 07:56:55 +0300 Subject: Fixed memory allocation in Unique to not allocate too much memory --- mysys/tree.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mysys/tree.c') 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); -- cgit v1.2.1