summaryrefslogtreecommitdiff
path: root/sql/sql_alloc.h
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-08-14 18:56:56 +0300
committerSergei Golubchik <serg@mariadb.org>2021-05-19 22:27:27 +0200
commitda85ad798708d045e7ba1963172daf81aeb80ab9 (patch)
tree8f162d22181719f35550b5f48c2b45ca82128bd0 /sql/sql_alloc.h
parentc76eabfb5e39a1b0831159decd3e0b544b9ad2e3 (diff)
downloadmariadb-git-da85ad798708d045e7ba1963172daf81aeb80ab9.tar.gz
Optimize Sql_alloc
- Remove 'dummy_for_valgrind' overrun marker as this doesn't help much. The element also distorts the sizes of objects a bit, which makes it harder to calculate gain in object sizes when doing size optimizations. - Replace usage of thd_get_current_thd() with _current_thd() - Avoid one extra call indirection when using thd_get_current_thd(), which is used by Sql_alloc, by replacing it with _current_thd()
Diffstat (limited to 'sql/sql_alloc.h')
-rw-r--r--sql/sql_alloc.h12
1 files changed, 3 insertions, 9 deletions
diff --git a/sql/sql_alloc.h b/sql/sql_alloc.h
index f475ecdff73..f5d2d4e8b1a 100644
--- a/sql/sql_alloc.h
+++ b/sql/sql_alloc.h
@@ -18,20 +18,18 @@
#include <my_sys.h> /* alloc_root, MEM_ROOT, TRASH */
-THD *thd_get_current_thd();
-
-/* mysql standard class memory allocator */
+/* MariaDB standard class memory allocator */
class Sql_alloc
{
public:
static void *operator new(size_t size) throw ()
{
- return thd_alloc(thd_get_current_thd(), size);
+ return thd_alloc(_current_thd(), size);
}
static void *operator new[](size_t size) throw ()
{
- return thd_alloc(thd_get_current_thd(), size);
+ return thd_alloc(_current_thd(), size);
}
static void *operator new[](size_t size, MEM_ROOT *mem_root) throw ()
{ return alloc_root(mem_root, size); }
@@ -42,9 +40,5 @@ public:
static void operator delete[](void *, MEM_ROOT *)
{ /* never called */ }
static void operator delete[](void *ptr, size_t size) { TRASH_FREE(ptr, size); }
-#ifdef HAVE_valgrind
- bool dummy_for_valgrind;
- inline Sql_alloc() :dummy_for_valgrind(0) {}
-#endif
};
#endif /* SQL_ALLOC_INCLUDED */