summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-02-24 02:36:32 +0200
committerMichael Widenius <monty@askmonty.org>2011-02-24 02:36:32 +0200
commite6c45f5e1fc91e0ec0cffc97d5bcd1f77cec4de2 (patch)
treec4385da2c44ff8bc5f57859afeb48079770d158a /mysys
parent1c23091c4ecc23100a6fe42288819cf4d5dc0b5b (diff)
downloadmariadb-git-e6c45f5e1fc91e0ec0cffc97d5bcd1f77cec4de2.tar.gz
- Reduced memory requirements for mysqltest to 1/4.th This also gave a speedup for 5x for some tests.
- Reduced memory usage from safe_mutex. - Fixed problem with failing tests that could not restart mysqld becasue the port was reserved - More DBUG information - Fixed bug where bitmap_set_prefix() wrote over buffer area. - Initialize n_pages_flushed in xtradb which was used uninitialized. client/mysqltest.cc: Reduced memory usage (400K -> 80 for simple test; 400M -> 70M for some other tests) - Smaller dynamic arrays at start - Made 'st_connection' significantly smaller by allocation 'mysql' on demand in mysql_init() and storing require_file in a mem_root. - Fixed that when one does --debug we get information from safemalloc in the trace (Most of changes are changing &connect->mysql to connect->mysql libmysql/libmysql.c: Don't call mysql_thread_end() if my_init() was called outside of mysql_server_init() This is needed to get information from my_end() into the DBUG log mysql-test/README: Fixed wrong comment mysql-test/mysql-test-run.pl: Reserv 20 ports / mysql-test-run thread. (Needed as some tests uses 9 mysqld servers) mysys/hash.c: More DBUG information mysys/my_bitmap.c: Fixed bug where bitmap_set_prefix() wrote over buffer area. mysys/safemalloc.c: More DBUG information mysys/thr_mutex.c: Initialize smaller arrays be default. sql-common/client.c: More DBUG_PRINT storage/xtradb/srv/srv0srv.c: Initialize n_pages_flushed which was used uninitialized.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/hash.c3
-rw-r--r--mysys/my_bitmap.c3
-rw-r--r--mysys/safemalloc.c4
-rw-r--r--mysys/thr_mutex.c20
4 files changed, 18 insertions, 12 deletions
diff --git a/mysys/hash.c b/mysys/hash.c
index 0e22ddcf215..924f0ef418d 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -130,7 +130,8 @@ static inline void my_hash_free_elements(HASH *hash)
void my_hash_free(HASH *hash)
{
DBUG_ENTER("my_hash_free");
- DBUG_PRINT("enter",("hash: 0x%lx", (long) hash));
+ DBUG_PRINT("enter",("hash: 0x%lx elements: %ld",
+ (long) hash, hash->records));
my_hash_free_elements(hash);
hash->free= 0;
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index 0c3f45be374..c89aec67da8 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -274,7 +274,10 @@ void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size)
memset(m, 0xff, prefix_bytes);
m+= prefix_bytes;
if ((prefix_bits= prefix_size & 7))
+ {
*m++= (1 << prefix_bits)-1;
+ prefix_bytes++;
+ }
if ((d= no_bytes_in_map(map)-prefix_bytes))
bzero(m, d);
}
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index 16489ccc022..7067ebbe843 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -124,7 +124,8 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
struct st_irem *irem;
uchar *data;
DBUG_ENTER("_mymalloc");
- DBUG_PRINT("enter",("Size: %lu", (ulong) size));
+ DBUG_PRINT("enter",("Size: %lu Total alloc: %lu", (ulong) size,
+ sf_malloc_cur_memory));
if (!sf_malloc_quick)
(void) _sanity (filename, lineno);
@@ -316,6 +317,7 @@ void _myfree(void *ptr, const char *filename, uint lineno, myf myflags)
sf_malloc_cur_memory-= irem->datasize;
sf_malloc_count--;
pthread_mutex_unlock(&THR_LOCK_malloc);
+ DBUG_PRINT("info", ("bytes freed: %ld", irem->datasize));
#ifndef HAVE_valgrind
/* Mark this data as free'ed */
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 77f2286b3d1..9421a3b2d98 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -170,16 +170,16 @@ static int safe_mutex_lazy_init_deadlock_detection(safe_mutex_t *mp)
pthread_mutex_lock(&THR_LOCK_mutex);
mp->id= ++safe_mutex_id;
pthread_mutex_unlock(&THR_LOCK_mutex);
- hash_init(mp->locked_mutex, &my_charset_bin,
- 1000,
- offsetof(safe_mutex_deadlock_t, id),
- sizeof(mp->id),
- 0, 0, HASH_UNIQUE);
- hash_init(mp->used_mutex, &my_charset_bin,
- 1000,
- offsetof(safe_mutex_t, id),
- sizeof(mp->id),
- 0, 0, HASH_UNIQUE);
+ hash_init2(mp->locked_mutex, 64, &my_charset_bin,
+ 128,
+ offsetof(safe_mutex_deadlock_t, id),
+ sizeof(mp->id),
+ 0, 0, HASH_UNIQUE);
+ hash_init2(mp->used_mutex, 64, &my_charset_bin,
+ 128,
+ offsetof(safe_mutex_t, id),
+ sizeof(mp->id),
+ 0, 0, HASH_UNIQUE);
return 0;
}