diff options
author | unknown <sasha@mysql.sashanet.com> | 2000-10-28 23:26:48 -0600 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2000-10-28 23:26:48 -0600 |
commit | 3dfc0a825ed3961460eb17b814fabab900adbffb (patch) | |
tree | d6984a4bdab21e43bace50514dc6578eafcae414 /mysys/safemalloc.c | |
parent | b0f645e4657abffc86e357fc334113af9e7cd380 (diff) | |
download | mariadb-git-3dfc0a825ed3961460eb17b814fabab900adbffb.tar.gz |
libmysql/libmysql.c
keep vio from being freed twice when we are low on memory
mysys/safemalloc.c
changes for --safemalloc-mem-limit
sql/mini_client.cc
keep vio from being freed twice
sql/mysqld.cc
changes for --safemalloc-mem-limit
sql/slave.cc
prevent closing connection twice
sql/sql_string.h
shrink() did not work right when my_realloc() failed
BitKeeper/etc/ignore:
Added .gdb_history to the ignore list
libmysql/libmysql.c:
keep vio from being freed twice when we are low on memory
mysys/safemalloc.c:
changes for --safemalloc-mem-limit
sql/mini_client.cc:
keep vio from being freed twice
sql/mysqld.cc:
changes for --safemalloc-mem-limit
sql/slave.cc:
prevent closing connection twice
sql/sql_string.h:
shrink() did not work right when my_realloc() failed
Diffstat (limited to 'mysys/safemalloc.c')
-rw-r--r-- | mysys/safemalloc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index d715f69e38a..589ed1c457b 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -73,6 +73,10 @@ #include "my_static.h" #include "mysys_err.h" +#ifndef DBUG_OFF +ulonglong safemalloc_mem_limit = 0; +#endif + #define pNext tInt._pNext #define pPrev tInt._pPrev #define sFileName tInt._sFileName @@ -125,11 +129,18 @@ gptr _mymalloc (uint uSize, const char *sFile, uint uLine, myf MyFlags) DBUG_ENTER("_mymalloc"); DBUG_PRINT("enter",("Size: %u",uSize)); + if (!sf_malloc_quick) (void) _sanity (sFile, uLine); - /* Allocate the physical memory */ - pTmp = (struct remember *) malloc ( +#ifndef DBUG_OFF + if(safemalloc_mem_limit && + uSize + lCurMemory > safemalloc_mem_limit) + pTmp = 0; + else +#endif + /* Allocate the physical memory */ + pTmp = (struct remember *) malloc ( sizeof (struct irem) /* remember data */ + sf_malloc_prehunc + uSize /* size requested */ |