summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorKristofer Pettersson <kpettersson@mysql.com>2008-07-24 22:38:44 +0200
committerKristofer Pettersson <kpettersson@mysql.com>2008-07-24 22:38:44 +0200
commit5c1f8d1836554f6978b8fe84acb3e3e1f207bca1 (patch)
tree87fb26d4be11fe0d8b5ddd517de3bd328ea5b6fc /sql/table.cc
parent58daa8d50a05e863ed6f24646b05d600070646af (diff)
downloadmariadb-git-5c1f8d1836554f6978b8fe84acb3e3e1f207bca1.tar.gz
Bug#38002 table_cache consumes too much memory with blobs
Tables in the table definition cache are keeping a cache buffer for blob fields which can consume a lot of memory. This patch introduces a maximum size threshold for these buffers.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc
index ebf3dfd748e..58cbde74822 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1999,6 +1999,28 @@ void free_blobs(register TABLE *table)
}
+/**
+ Reclaim temporary blob storage which is bigger than
+ a threshold.
+
+ @param table A handle to the TABLE object containing blob fields
+ @param size The threshold value.
+
+*/
+
+void free_field_buffers_larger_than(TABLE *table, uint32 size)
+{
+ uint *ptr, *end;
+ for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ;
+ ptr != end ;
+ ptr++)
+ {
+ Field_blob *blob= (Field_blob*) table->field[*ptr];
+ if (blob->get_field_buffer_size() > size)
+ blob->free();
+ }
+}
+
/* Find where a form starts */
/* if formname is NullS then only formnames is read */